VOID CreateOverlay( DWORD ProcessId ) { VOID *processHandle = 0; wchar_t filePath[260]; wchar_t *executableName; static int lastProcessId = 0; PUSH_GAME *game = NULL; if (lastProcessId == ProcessId) return; lastProcessId = ProcessId; processHandle = OpenProcess(ProcessId); if (!processHandle) { Log(L"Failed to get handle for PID %i", ProcessId); return; } Process_GetFileNameByHandle(processHandle, filePath); if (Game_IsGame(filePath)) { game = Memory_AllocateEx(sizeof(PUSH_GAME), HEAP_ZERO_MEMORY); Game_Initialize(filePath, game); } if (game && game->Settings.DisableOverlay) { Log(L"Skipping injection on %s", game->ExecutableName); return; } executableName = String_FindLastChar(filePath, '\\'); executableName++; Log(L"Injecting into %s", executableName); GameProcessId = ProcessId; if (PushOverlayInterface == OVERLAY_INTERFACE_PURE) { //Inject(processHandle); } else { if (!Process_GetId(L"RTSS.exe", 0)) { MessageBoxW(0, L"Rivatuner Statistics Server not running!", 0, 0); } } Process_Close(processHandle); }
VOID OnProcessEvent( PROCESSID ProcessId ) { WCHAR fileName[260]; VOID *processHandle = NULL; processHandle = Process_Open(ProcessId, PROCESS_QUERY_INFORMATION | PROCESS_SUSPEND_RESUME); if (!processHandle) return; Process_GetFileNameByHandle(processHandle, fileName); GetConfigFileFromProcessId(ProcessId, fileName); if (File_Exists(fileName)) { MOTIONINJOY_BUTTON_MAP map; PUSH_GAME game = { 0 }; //MiJ Memory_Clear(&map, sizeof(map)); PopulateButtonMap(&map, fileName); Memory_Copy(PushSharedMemory->ButtonMap, &map, sizeof(map)); SetButtonMapping(&map); PushSharedMemory->HasConfig = TRUE; DWORD bird = GetConfig(L"Spoof", fileName); if (bird) PushSharedMemory->SpoofControllerType = TRUE; Game_Initialize(fileName, &game); if (game.Settings.UseRamDisk) { PushSharedMemory->GameUsesRamDisk = TRUE; //suspend process to allow us time to cache files Process_Suspend(processHandle); Cache(&game); } PushSharedMemory->DisableRepeatKeys = game.Settings.DisableRepeatKeys; PushSharedMemory->SwapWASD = game.Settings.SwapWASD; PushSharedMemory->VsyncOverrideMode = game.Settings.VsyncOverrideMode; if (game.Settings.FrameLimit > 1) { PushSharedMemory->FrameLimit = game.Settings.FrameLimit; } // Check if user wants maximum gpu engine and memory clocks if (game.Settings.ForceMaxClocks) { Hardware_ForceMaxClocks(); } if (PushSharedMemory->GameUsesRamDisk) //resume process Process_Resume(processHandle); } else { PushSharedMemory->GameUsesRamDisk = FALSE; } Process_Close(processHandle); //terminate Xpadder unsigned int processId = Process_GetId(L"Xpadder.exe", 0); if (processId) { processHandle = Process_Open(processId, PROCESS_TERMINATE); Process_Terminate(processHandle); Process_Close(processHandle); } PushSharedMemory->OSDFlags |= OSD_FPS; //enable fps counter }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { SetWindowIconID(IDI_ICON1); SetMainWindowText(titlebar),ChangeWindowMode(TRUE), SetGraphMode(WIDTH, HEIGHT, 32), DxLib_Init(),SetDrawScreen(DX_SCREEN_BACK); //ウィンドウモード、960*720のサイズ //画像の読み込み GraphicHandle[0] = LoadGraph("image/Title.png"); GraphicHandle[1] = LoadGraph("image/Player.png"); GraphicHandle[2] = LoadGraph("image/Comet.png"); GraphicHandle[3] = LoadGraph("image/Backscreen.png"); GraphicHandle[4] = LoadGraph("image/Clearscreen.png"); GraphicHandle[5] = LoadGraph("image/Sf_title.png"); GraphicHandle[6] = LoadGraph("image/Buttun_on.png"); GraphicHandle[7] = LoadGraph("image/Buttun_off.png"); GraphicHandle[8] = LoadGraph("image/Ready.png"); GraphicHandle[9] = LoadGraph("image/Start.png"); GraphicHandle[10] = MakeScreen(1024, 1024, false); GraphicHandle[11] = LoadGraph("image/Ranking.png"); GraphicHandle[12] = LoadGraph("image/Pause.png"); //音楽の読み込み SoundHandle[0] = LoadSoundMem("music/bgm.mp3"); SoundHandle[1] = LoadSoundMem("music/select.mp3"); SoundHandle[2] = LoadSoundMem("music/deside.mp3"); SoundHandle[3] = LoadSoundMem("music/miss.mp3"); SoundHandle[4] = LoadSoundMem("music/gameover.mp3"); GScoreFont = CreateFontToHandle("Meiryo UI Bold", 20, -1); RScoreFont = CreateFontToHandle("Meiryo UI Bold", 32, -1); CScoreFont = CreateFontToHandle("Meiryo UI Bold", 64, -1); ChangeFont("Meiryo UI Bold"); //フォントの変更 Title_Initialize(); //タイトルの初期化処理 Game_Initialize(); //ゲームの初期化処理 Clear_Initialize(); //クリア画面の初期化処理 Rank_Initialize(); //ランキング画面の初期化処理 Logo_Initialize(); while (Loop() == true) { Keyboard_Update(); GamePad_Update(); switch (NowScene()) { //現在のシーンによって動作を変える case logo: Logo_Update(); break; case title: Title_Update(); Title_Draw(); break; case gamepre: Game_Initialize(); ChangeScene(game); case game: Game_Update(); Game_Draw(); break; case clear: Clear_Update(); Clear_Draw(); break; } } Title_Finalize(); //タイトルの終了処理 Game_Finalize(); //ゲームの終了処理 Clear_Finalize(); //クリア画面の終了処理 Rank_Finalize(); //ランキング画面の終了処理 Logo_Finalize(); //ロゴ画面の終了処理 DxLib_End(); // DXライブラリ使用の終了処理 return 0; }