Esempio n. 1
0
int SetupandLoad(){
    //memset to ensure we dont have unusual char attributes at starting
    memset(&Enemy, 0, sizeof(Character));
    memset(&Player, 0, sizeof(Character));
    //TODO temp hardcoding
    Enemy.weaponRange = 6;
    Player.weaponRange = 2.5;

    //get access to dark souls memory
    char * processName = "DARKSOULS.exe";
    //get the process id from the name
    int processId = GetProcessIdFromName(processName);
    //open the handle
    processHandle = OpenProcess(PROCESS_ALL_ACCESS, 0, processId);
    //get the base address of the process and append all other addresses onto it
    memorybase = GetModuleBase(processId, processName);
    Enemy_base_add += memorybase;
    player_base_add += memorybase;

    ReadPointerEndAddresses(processHandle);

    //start gui
    guiStart();

    //get current camera details to lock
    readCamera(&processHandle, memorybase);

    //load neural network and threads
    int error = ReadyThreads();
    if (error){
        return error;
    }

    //TODO load vJoy driver(we ONLY want the driver loaded when program running)
    //want to use controller input, instead of keyboard, as analog stick is more precise movement
    int loadresult = loadvJoy(iInterface);
    if (loadresult != 0){
        return loadresult;
    }
    iReport.bDevice = (BYTE)iInterface;
    ResetVJoyController();

    //set window focus
    HWND h = FindWindow(NULL, TEXT("DARK SOULS"));
    SetForegroundWindow(h);
    SetFocus(h);

    return EXIT_SUCCESS;
}
//___________________________________________________________
//      Generic Save Avi loop
//
//___________________________________________________________
//
uint8_t  GenericAviSave::saveAvi (const char *name)
{
    uint32_t size;
    uint8_t ret=0;
    strcpy(_name,name);
    //frametogo = frameEnd - frameStart + 1;
    frametogo=0;

    writter = new aviWrite ();
    // 1- setup audio
    guiStart();
    if (!setupAudio ())
    {
        guiStop();
        GUI_Error_HIG (QT_TR_NOOP("Error initalizing audio filters"), NULL);
        delete writter;
        writter = NULL;
        return 0;
    }

    if (!setupVideo (_name))
    {
        guiStop();
        GUI_Error_HIG (QT_TR_NOOP("Error initalizing video filters"), NULL);
        delete   	writter;
        writter = NULL;
        // guiStop();
        return 0;
    }

    // 3- setup video
    frametogo=_incoming->getInfo()->nb_frames;
    fps1000=_incoming->getInfo()->fps1000;
    printf ("\n writing %lu frames\n", frametogo);

    //__________________________________
    //   now go to main loop.....
    //__________________________________
    int frameDelay = 0;
    int videoSize;

    for (uint32_t cf = 0; cf < frametogo; cf++)
    {
        if (guiUpdate(cf, frametogo))
            goto abortme;

        for (;;)
        {
            videoSize = writeVideoChunk(cf + frameDelay);

            if (videoSize == 0 && _encode && (_encode->getRequirements() & ADM_ENC_REQ_NULL_FLUSH))
            {
                printf("skipping frame: %u size: %i\n", cf + frameDelay, videoSize);
                frameDelay++;
            }
            else
                break;
        }

        writeAudioChunk(cf);
    }

    ret=1;
abortme:
    guiStop ();
    //__________________________________
    // and end save
    //__________________________________
    writter->setEnd ();
    delete       writter;
    writter = NULL;
    // resync GUI
    printf ("\n Saving AVI (v_engine)... done\n");
    return ret;
}
Esempio n. 3
0
//___________________________________________________________
//      Generic Save Avi loop
//
//___________________________________________________________
//
uint8_t  GenericAviSave::saveAvi (const char *name)
{
uint32_t size;
uint8_t ret=0;
  strcpy(_name,name);
  //frametogo = frameEnd - frameStart + 1;
  frametogo=0;
  
  writter = new aviWrite ();
    // 1- setup audio
  guiStart();
  if (!setupAudio ())
    {
      guiStop();
      GUI_Error_HIG (QT_TR_NOOP("Error initalizing audio filters"), NULL);
      delete writter;
      writter = NULL;
      return 0;
    }
   
   if (!setupVideo (_name))
    {
      guiStop();
      GUI_Error_HIG (QT_TR_NOOP("Error initalizing video filters"), NULL);
      delete   	writter;
      writter = NULL;
     // guiStop();
      return 0;
    }
  
  // 3- setup video
  frametogo=_incoming->getInfo()->nb_frames;
  fps1000=_incoming->getInfo()->fps1000;
  printf ("\n writing %lu frames\n", frametogo);

  //__________________________________
  //   now go to main loop.....
  //__________________________________
  for (uint32_t cf = 0; cf < frametogo; cf++) 
    {
			
			
			
      			if (guiUpdate (cf, frametogo))
					goto abortme;
      			//   printf("\n %lu / %lu",cf,frametogo);
      			writeVideoChunk (cf);
      			writeAudioChunk (cf);
			//writter->sync();
     
     
    };				// end for
    ret=1;
abortme:
  guiStop ();
  //__________________________________
  // and end save
  //__________________________________
  writter->setEnd ();
  delete       writter;
  writter = NULL;
  // resync GUI
  printf ("\n Saving AVI (v_engine)... done\n");
  return ret;
}