/* Loads a game. */ RETRO_API bool retro_load_game(const struct retro_game_info* game) { char parent_dir[1024]; enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_XRGB8888; if (!game) return false; if (!LibretroUi::environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt)) { log_cb(RETRO_LOG_INFO, "XRGB8888 is not supported.\n"); return false; } extract_directory(parent_dir, game->path, sizeof(parent_dir)); init_easy_rpg(); log_cb(RETRO_LOG_INFO, "parent dir is: %s\n", parent_dir ); if (parent_dir[0] != '\0') { Main_Data::SetProjectPath(parent_dir); Player::Run(); } else { Main_Data::SetProjectPath("."); Player::Run(); } return true; }
bool retro_load_game(const struct retro_game_info *game) { struct retro_input_descriptor desc[] = { { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT, "D-Pad Left" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP, "D-Pad Up" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN, "D-Pad Down" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT, "D-Pad Right" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B, "Jump" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A, "Fire" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X, "Show/Hide Map" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L, "Previous Weapon" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R, "Next Weapon" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT, "Settings" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START, "Inventory" }, { 0 }, }; environ_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, desc); extract_directory(g_dir, game->path, sizeof(g_dir)); NX_LOG("g_dir: %s\n", g_dir); if (pre_main()) return 0; return 1; }
bool retro_load_game(const struct retro_game_info *game) { extract_directory(g_dir, game->path, sizeof(g_dir)); NX_LOG("g_dir: %s\n", g_dir); if (pre_main()) return 0; else return 1; }
static int extract_normal(LHAReader *reader, char *filename, LHADecoderProgressCallback callback, void *callback_data) { if (strcmp(reader->curr_file->compress_method, LHA_COMPRESS_TYPE_DIR) != 0) { return extract_file(reader, filename, callback, callback_data); } else if (reader->curr_file->symlink_target != NULL) { return extract_symlink(reader, filename); } else { return extract_directory(reader, filename); } }
bool retro_load_game(const struct retro_game_info *info) { check_variables(); #ifdef M16B memset(videoBuffer,0,1024*1024*2); #else memset(videoBuffer,0,1024*1024*2*2); #endif char basename[128]; extract_basename(basename, info->path, sizeof(basename)); extract_directory(g_rom_dir, info->path, sizeof(g_rom_dir)); strcpy(RPATH,info->path); return 1; }
bool retro_load_game(const struct retro_game_info *info) { struct retro_keyboard_callback cb = { keyboard_cb }; environ_cb(RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK, &cb); #ifdef M16B memset(videoBuffer,0,1024*1024*2); #else memset(videoBuffer,0,1024*1024*2*2); #endif char basename[128]; extract_basename(basename, info->path, sizeof(basename)); extract_directory(g_rom_dir, info->path, sizeof(g_rom_dir)); strcpy(RPATH,info->path); return 1; }
// // プログラム起動 // in: exe_name .. プログラムファイルパス // option_name .. プログラムコマンドラインオプション // pi .. プロセス情報格納構造体のポインタ // BOOL execute_process(TCHAR *exe_name, TCHAR *option_name, PROCESS_INFORMATION *pi) { STARTUPINFO si; TCHAR command[MAX_PATH], path[MAX_PATH]; DWORD create; ZeroMemory(pi, sizeof(PROCESS_INFORMATION)); GetStartupInfo(&si); wsprintf(command, _T("%s %s"), exe_name, option_name); lstrcpy(path, exe_name); extract_directory(path); create = CREATE_DEFAULT_ERROR_MODE; // 2011/9/1 kimukou.buzz //if(end_pattern == END_CTRL_BREAK) { if(end_pattern == END_CTRL_BREAK || end_pattern == END_CTRL_C) { // 2011/9/1 kimukou.buzz AllocConsole(); create |= CREATE_NEW_PROCESS_GROUP; } return CreateProcess(NULL, command, NULL, NULL, FALSE, create, NULL, path, &si, pi); }
// // Windows メイン関数 // int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpszArgs, int nWinMode) { MSG msg; HWND hMain; int err; // 初期化 install_flag = FALSE; uninstall_flag = FALSE; read_ini_flag = FALSE; start_flag = FALSE; no_error_flag = FALSE; question_flag = FALSE; ok_flag = FALSE; h_instance = hInstance; // 実行ディレクトリにある sexe.exe のフルパスを作成 GetModuleFileName(NULL, module_name, sizeof(module_name)); lstrcpy(execute_path, module_name); extract_directory(execute_path); lstrcpy(ini_name, execute_path); lstrcat(ini_name, _T("\\sexe.ini")); // コマンドライン解析 analyze_args(lpszArgs); // サービスで動作しているか? service_flag = check_execute_service(); // WindowsNT/2000 ? if(nt_flag) { // サービスとして動作中? if(service_flag) { // すでに動作中? if(!check_already()) { // サービスとして起動 start_service(); } } else { // 2011/5/31 // コマンドラインパラメータでインストール・アンインストール if(install_flag) { TCHAR *ext; if(service_name[0] == _T('\0')) { if(!no_error_flag) { // サービス名を指定してください MessageBoxResourceText(NULL, IDS_ERROR_NO_SERVICE_NAME, NULL, ERROR_HEADER, MB_OK); } return ERROR_PARAMETER; } ext = extract_ext(exe_name); if(exe_name[0] == _T('\0') || (_tcsicmp(ext, _T("exe")) && _tcsicmp(ext, _T("bat")))) { if(!no_error_flag) { // プログラム名を指定してください MessageBoxResourceText(NULL, IDS_ERROR_NO_PROGRAM_NAME, NULL, ERROR_HEADER, MB_OK); } return ERROR_PARAMETER; } if(question_flag) { // サービス service_name を登録しますか? if(MessageBoxResourceText(NULL, IDS_QUESTION_INSTALL, service_name, ERROR_HEADER, MB_YESNO) != IDYES) { return ERROR_NO_INSTALL; } } if(!read_ini_flag) { // ini ファイルから読み出したのでなければ設定値を保存 set_inifile(); } // インストール if((err = install_service()) == ERROR_SUCCESS) { if(start_flag) { // サービス開始 if(restart_service()) { if(ok_flag) { // サービス service_name を登録し、開始しました。 MessageBoxResourceText(NULL, IDS_INSTALL_START_OK, service_name, HEADER, MB_OK); } } else if(!no_error_flag) { // サービス service_name を登録しましたが、開始に失敗しました。 MessageBoxResourceText(NULL, IDS_ERROR_INSTALL_START, service_name, HEADER, MB_OK); return ERROR_START; } } else if(ok_flag) { // サービス service_name を登録しました。 MessageBoxResourceText(NULL, IDS_INSTALL_OK, service_name, HEADER, MB_OK); } } else { if(!no_error_flag) { if(err == ERROR_SERVICE_EXISTS) { // すでに同名のサービスが登録済みです MessageBoxResourceText(NULL, IDS_ERROR_SAME_SERVICE, NULL, ERROR_HEADER, MB_OK); } else { // サービスに登録できませんでした。\nサービスの権限があるユーザーでログインして実行してください。 MessageBoxResourceText(NULL, IDS_ERROR_INSTALL_SERVICE, NULL, ERROR_HEADER, MB_OK); } } return ERROR_INSTALL; } } else if(uninstall_flag) { if(service_name[0] == _T('\0')) { if(!no_error_flag) { // サービス名を指定してください MessageBoxResourceText(NULL, IDS_ERROR_NO_SERVICE_NAME, NULL, ERROR_HEADER, MB_OK); } return ERROR_PARAMETER; } if(question_flag) { // サービス service_name を削除しますか? if(MessageBoxResourceText(NULL, IDS_QUESTION_UNINSTALL, service_name, HEADER, MB_YESNO) != IDYES) { return ERROR_NO_INSTALL; } } if(service_install_flag) { // サービスから削除 if(remove_service()) { if(ok_flag) { // サービス service_name を削除しました MessageBoxResourceText(NULL, IDS_UNINSTALL_OK, service_name, HEADER, MB_OK); } } else { if(!no_error_flag) { // サービスから削除できませんでした。\nサービスの権限があるユーザーでログインして実行してください。 MessageBoxResourceText(NULL, IDS_ERROR_UNINSTALL_SERVICE, NULL, ERROR_HEADER, MB_OK); } return ERROR_INSTALL; } } else { if(!no_error_flag) { // サービス service_name は登録されていません MessageBoxResourceText(NULL, IDS_ERROR_NOT_INSTALL_SERVICE, service_name, ERROR_HEADER, MB_OK); } return ERROR_INSTALL; } } else { // 2010/6/10 Vista/7 で WM_DROPFILES を受ける funcChangeWindowMessageFilter ChangeWindowMessageFilter; if(ChangeWindowMessageFilter = (funcChangeWindowMessageFilter)GetProcAddress(LoadLibrary(_T("user32.dll")) ,"ChangeWindowMessageFilter")) { ChangeWindowMessageFilter(WM_DROPFILES, MSGFLT_ADD); ChangeWindowMessageFilter(WM_COPYDATA, MSGFLT_ADD); ChangeWindowMessageFilter(0x0049, MSGFLT_ADD); } // 設定ダイアログを表示 hMain = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOG_SETUP), GetDesktopWindow(), (DLGPROC)MainFunc); ShowWindow(hMain, SW_SHOW); // Drag&Drop を受け入れる準備 DragAcceptFiles(hMain, TRUE); while(GetMessage(&msg, NULL, 0, 0)) { if(!IsDialogMessage(hMain, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } } } } else { // Windows NT/2000/XP/Vista/7 で起動してください。 MessageBoxResourceText(NULL, IDS_ERROR_OS, NULL, ERROR_HEADER, MB_OK); } return 0; }
bool retro_load_game(const struct retro_game_info *info) { int argc = 0; static char *argv[32] = {NULL}; struct retro_input_descriptor desc[] = { { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT, "D-Pad Left" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP, "D-Pad Up" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN, "D-Pad Down" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT, "D-Pad Right" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B, "Strafe" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A, "Use" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X, "Fire" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y, "Run" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L, "Strafe Left" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R, "Strafe Right" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2, "Previous Weapon" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R2, "Next Weapon" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT, "Show/Hide Map" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START, "Settings" }, { 0 }, }; environ_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, desc); update_variables(true); extract_directory(g_wad_dir, info->path, sizeof(g_wad_dir)); extract_basename(g_basename, info->path, sizeof(g_basename)); argv[argc++] = strdup("prboom"); if(info->path) { argv[argc++] = strdup("-iwad"); argv[argc++] = strdup(g_basename); } myargc = argc; myargv = argv; if (!Z_Init()) /* 1/18/98 killough: start up memory stuff first */ goto failed; /* cphipps - call to video specific startup code */ if (!I_PreInitGraphics()) goto failed; if (!D_DoomMainSetup()) goto failed; return true; failed: { struct retro_message msg; char msg_local[256]; snprintf(msg_local, sizeof(msg_local), "ROM loading failed..."); msg.msg = msg_local; msg.frames = 360; if (environ_cb) environ_cb(RETRO_ENVIRONMENT_SET_MESSAGE, (void*)&msg); } if (screen_buf) free(screen_buf); I_SafeExit(-1); return false; }
bool retro_load_game(const struct retro_game_info *info) { quakeparms_t parms; extract_directory(g_rom_dir, info->path, sizeof(g_rom_dir)); snprintf(g_pak_path, sizeof(g_pak_path), "%s", info->path); MEMSIZE_MB = DEFAULT_MEMSIZE_MB; if (strstr(info->path, "hipnotic") || strstr(info->path, "rogue") || strstr(info->path, "HIPNOTIC") || strstr(info->path, "ROGUE")) { #if defined(HW_RVL) || defined(_XBOX1) MEMSIZE_MB = 16; #endif extract_directory(g_rom_dir, g_rom_dir, sizeof(g_rom_dir)); } memset(&parms, 0, sizeof(parms)); COM_InitArgv(0, NULL); parms.argc = com_argc; parms.argv = com_argv; parms.basedir = g_rom_dir; parms.memsize = MEMSIZE_MB * 1024 * 1024; heap = (unsigned char*)malloc(parms.memsize); parms.membase = heap; #ifdef NQ_HACK fprintf(stderr, "Quake Libretro -- TyrQuake Version %s\n", stringify(TYR_VERSION)); #endif #ifdef QW_HACK fprintf(stderr, "QuakeWorld Libretro -- TyrQuake Version %s\n", stringify(TYR_VERSION)); #endif Sys_Init(); Host_Init(&parms); Cvar_Set("cl_bob", "0.02"); Cvar_Set("crosshair", "0"); Cvar_Set("viewsize", "100"); Cvar_Set("showram", "0"); Cvar_Set("dither_filter", "1"); Cvar_RegisterVariable(&framerate); Cvar_Set("framerate", "60"); enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_RGB565; if (!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt)) { fprintf(stderr, "RGB565 is not supported.\n"); return false; } /* set keyboard callback */ //struct retro_keyboard_callback cb = { keyboard_cb }; //environ_cb(RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK, &cb); #ifdef NQ_HACK oldtime = Sys_DoubleTime() - 0.1; #endif #ifdef QW_HACK oldtime = Sys_DoubleTime(); #endif return true; }
bool retro_load_game(const struct retro_game_info *info) { char filename_bios[MAX_PATH]; const char *dir = NULL; struct retro_input_descriptor desc[] = { { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT, "D-Pad Left" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP, "D-Pad Up" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN, "D-Pad Down" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT, "D-Pad Right" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B, "B" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A, "A" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L, "L" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R, "R" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT, "Select" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START, "Start" }, { 0 }, }; if (!info) return false; environ_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, desc); enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_RGB565; if (!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt)) { if (log_cb) log_cb(RETRO_LOG_INFO, "[TempGBA]: 0RGB1555 is not supported.\n"); return false; } extract_directory(main_path,info->path,sizeof(main_path)); if (environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &dir) && dir) strncpy(filename_bios, dir, sizeof(filename_bios)); else strncpy(filename_bios, main_path, sizeof(filename_bios)); strncat(filename_bios, "/gba_bios.bin",sizeof(filename_bios)); if (environ_cb(RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY, &dir) && dir) strncpy(dir_save, dir, sizeof(dir_save)); else strncpy(dir_save, main_path, sizeof(dir_save)); strncat(dir_save, "/",sizeof(dir_save)); strncat(main_path, "/",sizeof(main_path)); if (load_bios(filename_bios) < 0) { error_msg("Could not load BIOS image file.\n"); return false; } gamepak_filename[0] = 0; if (load_gamepak(info->path) < 0) { error_msg("Could not load the game file.\n"); return false; } reset_gba(); init_context_switch(); return true; }