Windows: Remove game selection dialog

This commit is contained in:
kichikuou
2024-01-20 11:55:29 +09:00
parent 409fa83406
commit 22192c245f
6 changed files with 1 additions and 59 deletions
+1 -2
View File
@@ -69,8 +69,7 @@ other platforms, refer to the [Building](#building) section.
## Running
### Windows
Execute `xsystem35`, and a dialog will appear for you to select a folder.
Choose the game folder (where the ALD files are located).
Copy `xsystem35.exe` to the game folder and run it.
### Android
-1
View File
@@ -35,7 +35,6 @@
#define RC_NAME ".xsys35rc"
#define RC_LINE_CHARS_MAX 256
#define REGKEY_PROFILE XSYSTEM35_REGKEY "\\profile"
struct profile_kv {
char *name;
-46
View File
@@ -17,7 +17,6 @@
*
*/
#include <windows.h>
#include <shlobj.h>
#undef min
#undef max
#include <SDL_syswm.h>
@@ -25,8 +24,6 @@
#include "sdl_private.h"
#include "resources.h"
#define REGVAL_RECENT_FOLDER "RecentFolder"
static HWND get_hwnd(SDL_Window *window) {
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
@@ -34,49 +31,6 @@ static HWND get_hwnd(SDL_Window *window) {
return info.info.win.window;
}
static int CALLBACK select_game_callback(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData) {
if (uMsg == BFFM_INITIALIZED)
SendMessage(hwnd, BFFM_SETSELECTION, (WPARAM)TRUE, lpData);
return 0;
}
boolean current_folder_has_ald(void) {
WIN32_FIND_DATA find_data;
HANDLE hFind = FindFirstFile("*.ALD", &find_data);
if (hFind == INVALID_HANDLE_VALUE)
return FALSE;
FindClose(hFind);
return TRUE;
}
boolean select_game_folder(void) {
char title[256];
LoadString(GetModuleHandle(NULL), IDS_CHOOSE_GAME_FOLDER, title, sizeof(title));
char path[MAX_PATH] = "";
DWORD value_size = sizeof(path);
RegGetValue(HKEY_CURRENT_USER, XSYSTEM35_REGKEY, REGVAL_RECENT_FOLDER,
RRF_RT_REG_SZ, NULL, path, &value_size);
BROWSEINFO bi = {
.lpszTitle = title,
.ulFlags = BIF_RETURNONLYFSDIRS,
.lpfn = &select_game_callback,
.lParam = (LPARAM)path,
};
LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
if (!pidl)
return FALSE;
SHGetPathFromIDList(pidl, path);
CoTaskMemFree(pidl);
if (!SetCurrentDirectory(path))
return FALSE;
RegSetKeyValue(HKEY_CURRENT_USER, XSYSTEM35_REGKEY, REGVAL_RECENT_FOLDER,
REG_SZ, path, strlen(path) + 1);
return TRUE;
}
static INT_PTR CALLBACK text_dialog_proc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static INPUTSTRING_PARAM *p;
-2
View File
@@ -24,8 +24,6 @@
struct inputstring_param;
struct inputnum_param;
boolean current_folder_has_ald(void);
boolean select_game_folder(void);
boolean input_string(struct inputstring_param *p);
boolean input_number(struct inputnum_param *p);
-2
View File
@@ -19,8 +19,6 @@
#ifndef __RESOURCES_H__
#define __RESOURCES_H__
#define XSYSTEM35_REGKEY "Software\\Kichikuou\\xsystem35"
#define IDR_MENU1 101
#define IDD_DIALOG1 103
#define IDC_TEXT 104
-6
View File
@@ -476,12 +476,6 @@ int main(int argc, char **argv) {
if (strcmp(argv[1], "-gamedir") == 0)
chdir(argv[2]);
#endif
#ifdef _WIN32
if (argc == 1 && !current_folder_has_ald()) {
if (!select_game_folder())
return 0;
}
#endif
load_profile();
check_profile();