mirror of
https://gitea.tendokyu.moe/Dniel97/segatools.git
synced 2025-02-20 20:41:22 +01:00
add changeable config path
This commit is contained in:
parent
6d8ffb46ef
commit
11556a1332
4
.clang-format
Normal file
4
.clang-format
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
BasedOnStyle: Google
|
||||
IndentWidth: 4
|
||||
---
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "util/crc.h"
|
||||
#include "util/dprintf.h"
|
||||
#include "util/env.h"
|
||||
|
||||
struct aime_io_config {
|
||||
wchar_t aime_path[MAX_PATH];
|
||||
@ -222,7 +223,7 @@ uint16_t aime_io_get_api_version(void)
|
||||
|
||||
HRESULT aime_io_init(void)
|
||||
{
|
||||
aime_io_config_read(&aime_io_cfg, L".\\segatools.ini");
|
||||
aime_io_config_read(&aime_io_cfg, get_config_path());
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -53,6 +53,7 @@
|
||||
#include "platform/platform.h"
|
||||
|
||||
#include "util/dprintf.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static HMODULE carol_hook_mod;
|
||||
static process_entry_t carol_startup;
|
||||
@ -100,7 +101,7 @@ static DWORD CALLBACK carol_pre_startup(void)
|
||||
|
||||
/* Config load */
|
||||
|
||||
carol_hook_config_load(&carol_hook_cfg, L".\\segatools.ini");
|
||||
carol_hook_config_load(&carol_hook_cfg, get_config_path());
|
||||
|
||||
/* Hook Win32 APIs */
|
||||
|
||||
@ -164,7 +165,7 @@ static DWORD CALLBACK carol_pre_startup(void)
|
||||
}
|
||||
/* Initialize debug helpers */
|
||||
|
||||
spike_hook_init(L".\\segatools.ini");
|
||||
spike_hook_init(get_config_path());
|
||||
|
||||
dprintf("--- End carol_pre_startup ---\n");
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "carolio/carolio.h"
|
||||
#include "carolio/config.h"
|
||||
#include "util/dprintf.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static unsigned int __stdcall carol_io_touch_thread_proc(void *ctx);
|
||||
|
||||
@ -25,7 +26,7 @@ uint16_t carol_io_get_api_version(void)
|
||||
|
||||
HRESULT carol_io_jvs_init(void)
|
||||
{
|
||||
carol_io_config_load(&carol_io_cfg, L".\\segatools.ini");
|
||||
carol_io_config_load(&carol_io_cfg, get_config_path());
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@ -178,4 +179,4 @@ static unsigned int __stdcall carol_io_touch_thread_proc(void *ctx)
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "platform/platform.h"
|
||||
|
||||
#include "util/dprintf.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static HMODULE chuni_hook_mod;
|
||||
static process_entry_t chuni_startup;
|
||||
@ -71,7 +72,7 @@ static DWORD CALLBACK chuni_pre_startup(void)
|
||||
|
||||
/* Config load */
|
||||
|
||||
chuni_hook_config_load(&chuni_hook_cfg, L".\\segatools.ini");
|
||||
chuni_hook_config_load(&chuni_hook_cfg, get_config_path());
|
||||
|
||||
/* Hook Win32 APIs */
|
||||
|
||||
@ -129,7 +130,7 @@ static DWORD CALLBACK chuni_pre_startup(void)
|
||||
|
||||
/* Initialize debug helpers */
|
||||
|
||||
spike_hook_init(L".\\segatools.ini");
|
||||
spike_hook_init(get_config_path());
|
||||
|
||||
dprintf("--- End chuni_pre_startup ---\n");
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "chuniio/ledoutput.h"
|
||||
|
||||
#include "util/dprintf.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static unsigned int __stdcall chuni_io_slider_thread_proc(void *ctx);
|
||||
|
||||
@ -27,7 +28,7 @@ uint16_t chuni_io_get_api_version(void)
|
||||
|
||||
HRESULT chuni_io_jvs_init(void)
|
||||
{
|
||||
chuni_io_config_load(&chuni_io_cfg, L".\\segatools.ini");
|
||||
chuni_io_config_load(&chuni_io_cfg, get_config_path());
|
||||
|
||||
led_init_mutex = CreateMutex(
|
||||
NULL, // default security attributes
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "platform/platform.h"
|
||||
|
||||
#include "util/dprintf.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static HMODULE chusan_hook_mod;
|
||||
static process_entry_t chusan_startup;
|
||||
@ -84,7 +85,7 @@ static DWORD CALLBACK chusan_pre_startup(void)
|
||||
|
||||
/* Config load */
|
||||
|
||||
chusan_hook_config_load(&chusan_hook_cfg, L".\\segatools.ini");
|
||||
chusan_hook_config_load(&chusan_hook_cfg, get_config_path());
|
||||
|
||||
/* Hook Win32 APIs */
|
||||
|
||||
@ -173,7 +174,7 @@ static DWORD CALLBACK chusan_pre_startup(void)
|
||||
|
||||
/* Initialize debug helpers */
|
||||
|
||||
spike_hook_init(L".\\segatools.ini");
|
||||
spike_hook_init(get_config_path());
|
||||
|
||||
dprintf("--- End chusan_pre_startup ---\n");
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "unityhook/hook.h"
|
||||
|
||||
#include "util/dprintf.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static HMODULE cm_hook_mod;
|
||||
static process_entry_t cm_startup;
|
||||
@ -48,7 +49,7 @@ static DWORD CALLBACK cm_pre_startup(void)
|
||||
|
||||
/* Load config */
|
||||
|
||||
cm_hook_config_load(&cm_hook_cfg, L".\\segatools.ini");
|
||||
cm_hook_config_load(&cm_hook_cfg, get_config_path());
|
||||
|
||||
/* Hook Win32 APIs */
|
||||
|
||||
@ -105,7 +106,7 @@ static DWORD CALLBACK cm_pre_startup(void)
|
||||
|
||||
/* Initialize debug helpers */
|
||||
|
||||
spike_hook_init(L".\\segatools.ini");
|
||||
spike_hook_init(get_config_path());
|
||||
|
||||
dprintf("--- End cm_pre_startup ---\n");
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "cmio/cmio.h"
|
||||
#include "cmio/config.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static uint8_t cm_opbtn;
|
||||
static struct cm_io_config cm_io_cfg;
|
||||
@ -18,7 +19,7 @@ uint16_t cm_io_get_api_version(void)
|
||||
|
||||
HRESULT cm_io_init(void)
|
||||
{
|
||||
cm_io_config_load(&cm_io_cfg, L".\\segatools.ini");
|
||||
cm_io_config_load(&cm_io_cfg, get_config_path());
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "platform/platform.h"
|
||||
|
||||
#include "util/dprintf.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static HMODULE cxb_hook_mod;
|
||||
static process_entry_t cxb_startup;
|
||||
@ -58,7 +59,7 @@ static DWORD CALLBACK cxb_pre_startup(void)
|
||||
|
||||
/* Config load */
|
||||
|
||||
cxb_hook_config_load(&cxb_hook_cfg, L".\\segatools.ini");
|
||||
cxb_hook_config_load(&cxb_hook_cfg, get_config_path());
|
||||
|
||||
/* Hook Win32 APIs */
|
||||
|
||||
@ -110,7 +111,7 @@ static DWORD CALLBACK cxb_pre_startup(void)
|
||||
|
||||
/* Initialize debug helpers */
|
||||
|
||||
spike_hook_init(L".\\segatools.ini");
|
||||
spike_hook_init(get_config_path());
|
||||
|
||||
dprintf("--- End cxb_pre_startup ---\n");
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "cxbio/config.h"
|
||||
|
||||
#include "util/dprintf.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static bool cxb_io_coin;
|
||||
static int cxb_io_coins;
|
||||
@ -21,7 +22,7 @@ uint16_t cxb_io_get_api_version(void)
|
||||
HRESULT cxb_io_revio_init(void)
|
||||
{
|
||||
dprintf("CXB IO: REVIO init\n");
|
||||
cxb_io_config_load(&cxb_io_cfg, L".\\segatools.ini");
|
||||
cxb_io_config_load(&cxb_io_cfg, get_config_path());
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@ -75,4 +76,4 @@ HRESULT cxb_io_led_init(void)
|
||||
}
|
||||
|
||||
void cxb_io_led_update(int id, int color)
|
||||
{}
|
||||
{}
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "platform/platform.h"
|
||||
|
||||
#include "util/dprintf.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static HMODULE diva_hook_mod;
|
||||
static process_entry_t diva_startup;
|
||||
@ -58,7 +59,7 @@ static DWORD CALLBACK diva_pre_startup(void)
|
||||
|
||||
/* Config load */
|
||||
|
||||
diva_hook_config_load(&diva_hook_cfg, L".\\segatools.ini");
|
||||
diva_hook_config_load(&diva_hook_cfg, get_config_path());
|
||||
|
||||
/* Hook Win32 APIs */
|
||||
|
||||
@ -105,7 +106,7 @@ static DWORD CALLBACK diva_pre_startup(void)
|
||||
|
||||
/* Initialize debug helpers */
|
||||
|
||||
spike_hook_init(L".\\segatools.ini");
|
||||
spike_hook_init(get_config_path());
|
||||
|
||||
dprintf("--- End diva_pre_startup ---\n");
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "divaio/divaio.h"
|
||||
#include "divaio/config.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static unsigned int __stdcall diva_io_slider_thread_proc(void *ctx);
|
||||
|
||||
@ -23,7 +24,7 @@ uint16_t diva_io_get_api_version(void)
|
||||
|
||||
HRESULT diva_io_jvs_init(void)
|
||||
{
|
||||
diva_io_config_load(&diva_io_cfg, L".\\segatools.ini");
|
||||
diva_io_config_load(&diva_io_cfg, get_config_path());
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -6,6 +6,17 @@ all games.
|
||||
Keyboard binding settings use
|
||||
[Virtual-Key Codes](https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes).
|
||||
|
||||
## Config Path
|
||||
The default file path for config file is `./segatools.ini`.
|
||||
|
||||
You can modify environment variable `SEGATOOLS_CONFIG_PATH` to another path.
|
||||
|
||||
For example, You can have a another start.bat with following code in it,
|
||||
Then you can copy `segatools.ini` to `another_config.ini` but with different dns host in it
|
||||
```bat
|
||||
set SEGATOOLS_CONFIG_PATH=.\another_config.ini
|
||||
```
|
||||
|
||||
## `[aimeio]`
|
||||
|
||||
Controls the card reader driver.
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "platform/platform.h"
|
||||
|
||||
#include "util/dprintf.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static HMODULE fgo_hook_mod;
|
||||
static process_entry_t fgo_startup;
|
||||
@ -69,7 +70,7 @@ static DWORD CALLBACK fgo_pre_startup(void)
|
||||
|
||||
/* Load config */
|
||||
|
||||
fgo_hook_config_load(&fgo_hook_cfg, L".\\segatools.ini");
|
||||
fgo_hook_config_load(&fgo_hook_cfg, get_config_path());
|
||||
|
||||
/* Hook Win32 APIs */
|
||||
|
||||
@ -147,7 +148,7 @@ static DWORD CALLBACK fgo_pre_startup(void)
|
||||
|
||||
/* Initialize debug helpers */
|
||||
|
||||
spike_hook_init(L".\\segatools.ini");
|
||||
spike_hook_init(get_config_path());
|
||||
|
||||
dprintf("--- End fgo_pre_startup ---\n");
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "fgoio/fgoio.h"
|
||||
#include "fgoio/config.h"
|
||||
#include "util/dprintf.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static uint8_t fgo_opbtn;
|
||||
static uint8_t fgo_gamebtn;
|
||||
@ -23,7 +24,7 @@ uint16_t fgo_io_get_api_version(void)
|
||||
|
||||
HRESULT fgo_io_init(void)
|
||||
{
|
||||
fgo_io_config_load(&fgo_io_cfg, L".\\segatools.ini");
|
||||
fgo_io_config_load(&fgo_io_cfg, get_config_path());
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "platform/platform.h"
|
||||
|
||||
#include "util/dprintf.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static HMODULE idac_hook_mod;
|
||||
static process_entry_t idac_startup;
|
||||
@ -49,7 +50,7 @@ static DWORD CALLBACK idac_pre_startup(void)
|
||||
|
||||
/* Config load */
|
||||
|
||||
idac_hook_config_load(&idac_hook_cfg, L".\\segatools.ini");
|
||||
idac_hook_config_load(&idac_hook_cfg, get_config_path());
|
||||
|
||||
/* Hook Win32 APIs */
|
||||
|
||||
@ -109,7 +110,7 @@ static DWORD CALLBACK idac_pre_startup(void)
|
||||
|
||||
/* Initialize debug helpers */
|
||||
|
||||
spike_hook_init(L".\\segatools.ini");
|
||||
spike_hook_init(get_config_path());
|
||||
|
||||
dprintf("--- End idac_pre_startup ---\n");
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "util/dprintf.h"
|
||||
#include "util/str.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static struct idac_io_config idac_io_cfg;
|
||||
static const struct idac_io_backend *idac_io_backend;
|
||||
@ -38,7 +39,7 @@ HRESULT idac_io_init(void)
|
||||
return hr;
|
||||
}
|
||||
|
||||
idac_io_config_load(&idac_io_cfg, L".\\segatools.ini");
|
||||
idac_io_config_load(&idac_io_cfg, get_config_path());
|
||||
|
||||
if (wstr_ieq(idac_io_cfg.mode, L"dinput")) {
|
||||
hr = idac_di_init(&idac_io_cfg.di, inst, &idac_io_backend);
|
||||
|
@ -40,6 +40,7 @@
|
||||
|
||||
#include "util/dprintf.h"
|
||||
#include "util/lib.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static HMODULE idz_hook_mod;
|
||||
static process_entry_t idz_startup;
|
||||
@ -55,7 +56,7 @@ static DWORD CALLBACK idz_pre_startup(void)
|
||||
|
||||
/* Config load */
|
||||
|
||||
idz_hook_config_load(&idz_hook_cfg, L".\\segatools.ini");
|
||||
idz_hook_config_load(&idz_hook_cfg, get_config_path());
|
||||
|
||||
module_path = module_file_name(NULL);
|
||||
|
||||
@ -136,7 +137,7 @@ static DWORD CALLBACK idz_pre_startup(void)
|
||||
|
||||
/* Initialize debug helpers */
|
||||
|
||||
spike_hook_init(L".\\segatools.ini");
|
||||
spike_hook_init(get_config_path());
|
||||
|
||||
dprintf("--- End idz_pre_startup ---\n");
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "util/dprintf.h"
|
||||
#include "util/str.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static struct idz_io_config idz_io_cfg;
|
||||
static const struct idz_io_backend *idz_io_backend;
|
||||
@ -39,7 +40,7 @@ HRESULT idz_io_jvs_init(void)
|
||||
return hr;
|
||||
}
|
||||
|
||||
idz_io_config_load(&idz_io_cfg, L".\\segatools.ini");
|
||||
idz_io_config_load(&idz_io_cfg, get_config_path());
|
||||
|
||||
if (wstr_ieq(idz_io_cfg.mode, L"dinput")) {
|
||||
hr = idz_di_init(&idz_io_cfg.di, inst, &idz_io_backend);
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "unityhook/hook.h"
|
||||
|
||||
#include "util/dprintf.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static HMODULE kemono_hook_mod;
|
||||
static process_entry_t kemono_startup;
|
||||
@ -35,7 +36,7 @@ static DWORD CALLBACK kemono_pre_startup(void) {
|
||||
/* Load config */
|
||||
|
||||
kemono_hook_cfg.aime.dll.path64 = true;
|
||||
kemono_hook_config_load(&kemono_hook_cfg, L".\\segatools.ini");
|
||||
kemono_hook_config_load(&kemono_hook_cfg, get_config_path());
|
||||
|
||||
/* Hook Win32 APIs */
|
||||
|
||||
@ -107,7 +108,7 @@ static DWORD CALLBACK kemono_pre_startup(void) {
|
||||
|
||||
/* Initialize debug helpers */
|
||||
|
||||
spike_hook_init(L".\\segatools.ini");
|
||||
spike_hook_init(get_config_path());
|
||||
|
||||
dprintf("--- End kemono_pre_startup ---\n");
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "kemonoio/kemonoio.h"
|
||||
#include "kemonoio/config.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static uint8_t kemono_opbtn;
|
||||
static uint16_t kemono_pbtn;
|
||||
@ -19,7 +20,7 @@ uint16_t kemono_io_get_api_version(void) {
|
||||
}
|
||||
|
||||
HRESULT kemono_io_init(void) {
|
||||
kemono_io_config_load(&kemono_io_cfg, L".\\segatools.ini");
|
||||
kemono_io_config_load(&kemono_io_cfg, get_config_path());
|
||||
|
||||
kemono_io_coins = 0;
|
||||
|
||||
@ -106,4 +107,4 @@ void kemono_io_led_set_colors(uint8_t board, uint8_t *rgb) {
|
||||
|
||||
void kemono_io_jvs_write_gpio(uint32_t state){
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "unityhook/hook.h"
|
||||
|
||||
#include "util/dprintf.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static HMODULE mai2_hook_mod;
|
||||
static process_entry_t mai2_startup;
|
||||
@ -54,7 +55,7 @@ static DWORD CALLBACK mai2_pre_startup(void)
|
||||
|
||||
/* Load config */
|
||||
|
||||
mai2_hook_config_load(&mai2_hook_cfg, L".\\segatools.ini");
|
||||
mai2_hook_config_load(&mai2_hook_cfg, get_config_path());
|
||||
|
||||
/* Hook Win32 APIs */
|
||||
|
||||
@ -106,7 +107,7 @@ static DWORD CALLBACK mai2_pre_startup(void)
|
||||
|
||||
/* Initialize debug helpers */
|
||||
|
||||
spike_hook_init(L".\\segatools.ini");
|
||||
spike_hook_init(get_config_path());
|
||||
|
||||
dprintf("--- End mai2_pre_startup ---\n");
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "mai2io/mai2io.h"
|
||||
#include "mai2io/config.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static uint8_t mai2_opbtn;
|
||||
static uint16_t mai2_player1_btn;
|
||||
@ -19,7 +20,7 @@ uint16_t mai2_io_get_api_version(void)
|
||||
|
||||
HRESULT mai2_io_init(void)
|
||||
{
|
||||
mai2_io_config_load(&mai2_io_cfg, L".\\segatools.ini");
|
||||
mai2_io_config_load(&mai2_io_cfg, get_config_path());
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@ -140,4 +141,4 @@ void mai2_io_get_gamebtns(uint16_t *player1, uint16_t *player2)
|
||||
if (player2 != NULL ){
|
||||
*player2 = mai2_player2_btn;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "platform/platform.h"
|
||||
|
||||
#include "util/dprintf.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static HMODULE mercury_hook_mod;
|
||||
static process_entry_t mercury_startup;
|
||||
@ -49,7 +50,7 @@ static DWORD CALLBACK mercury_pre_startup(void)
|
||||
|
||||
/* Load config */
|
||||
|
||||
mercury_hook_config_load(&mercury_hook_cfg, L".\\segatools.ini");
|
||||
mercury_hook_config_load(&mercury_hook_cfg, get_config_path());
|
||||
|
||||
/* Hook Win32 APIs */
|
||||
|
||||
@ -102,7 +103,7 @@ static DWORD CALLBACK mercury_pre_startup(void)
|
||||
|
||||
/* Initialize debug helpers */
|
||||
|
||||
spike_hook_init(L".\\segatools.ini");
|
||||
spike_hook_init(get_config_path());
|
||||
|
||||
dprintf("--- End mercury_pre_startup ---\n");
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "mercuryio/mercuryio.h"
|
||||
#include "mercuryio/config.h"
|
||||
#include "mercuryhook/elisabeth.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static unsigned int __stdcall mercury_io_touch_thread_proc(void *ctx);
|
||||
|
||||
@ -23,7 +24,7 @@ uint16_t mercury_io_get_api_version(void)
|
||||
|
||||
HRESULT mercury_io_init(void)
|
||||
{
|
||||
mercury_io_config_load(&mercury_io_cfg, L".\\segatools.ini");
|
||||
mercury_io_config_load(&mercury_io_cfg, get_config_path());
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "platform/nusec.h"
|
||||
|
||||
#include "util/dprintf.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static process_entry_t app_startup;
|
||||
|
||||
@ -26,10 +27,10 @@ static DWORD CALLBACK app_pre_startup(void)
|
||||
|
||||
dprintf("--- Begin %s ---\n", __func__);
|
||||
|
||||
clock_config_load(&clock_cfg, L".\\segatools.ini");
|
||||
ds_config_load(&ds_cfg, L".\\segatools.ini");
|
||||
nusec_config_load(&nusec_cfg, L".\\segatools.ini");
|
||||
spike_hook_init(L".\\segatools.ini");
|
||||
clock_config_load(&clock_cfg, get_config_path());
|
||||
ds_config_load(&ds_cfg, get_config_path());
|
||||
nusec_config_load(&nusec_cfg, get_config_path());
|
||||
spike_hook_init(get_config_path());
|
||||
|
||||
hr = clock_hook_init(&clock_cfg);
|
||||
|
||||
|
@ -31,7 +31,7 @@ if /I "%1"=="build" (
|
||||
set VSVARSALL=!VSVARSALL!
|
||||
set MESON=!MESON!
|
||||
|
||||
call :build
|
||||
call :build %2
|
||||
|
||||
echo.
|
||||
echo Build done!
|
||||
@ -42,9 +42,12 @@ if /I "%1"=="zip" (
|
||||
exit /b
|
||||
)
|
||||
|
||||
echo %~nx0 [action]
|
||||
echo %~nx0 [action] [switch]
|
||||
echo build: Build the for both x86 and x64
|
||||
echo /PROJECTONLY: Only create projects
|
||||
echo.
|
||||
echo zip: Make zip file
|
||||
echo.
|
||||
exit /b
|
||||
|
||||
rem This should works for Visual Studio 2017+
|
||||
@ -85,6 +88,7 @@ rem This should works for Visual Studio 2017+
|
||||
)
|
||||
|
||||
:detect-meson (
|
||||
set MESON=""
|
||||
for /f "tokens=* usebackq" %%i in (`where meson`) do set MESON="%%i"
|
||||
if not exist %MESON% (
|
||||
exit /b 1
|
||||
@ -98,28 +102,32 @@ rem This should works for Visual Studio 2017+
|
||||
call %VSVARSALL% x64
|
||||
|
||||
if exist %BUILD_DIR_64% (
|
||||
%MESON% setup %BUILD_DIR_64% --backend vs --buildtype release --reconfigure
|
||||
%MESON% setup %BUILD_DIR_64% --buildtype release --reconfigure
|
||||
) else (
|
||||
%MESON% setup %BUILD_DIR_64% --backend vs --buildtype release
|
||||
)
|
||||
|
||||
pushd %BUILD_DIR_64%
|
||||
msbuild /m /p:Configuration=release /p:Platform=x64 segatools.sln
|
||||
popd
|
||||
if /I not "%1"=="/PROJECTONLY" (
|
||||
pushd %BUILD_DIR_64%
|
||||
msbuild /m /p:Configuration=release /p:Platform=x64 segatools.sln
|
||||
popd
|
||||
)
|
||||
)
|
||||
|
||||
:build_x86 (
|
||||
call %VSVARSALL% x86
|
||||
|
||||
if exist %BUILD_DIR_32% (
|
||||
%MESON% setup %BUILD_DIR_32% --backend vs --buildtype release --reconfigure
|
||||
%MESON% setup %BUILD_DIR_32% --buildtype release --reconfigure
|
||||
) else (
|
||||
%MESON% setup %BUILD_DIR_32% --backend vs --buildtype release
|
||||
)
|
||||
|
||||
pushd %BUILD_DIR_32%
|
||||
msbuild /m /p:Configuration=release /p:Platform=Win32 segatools.sln
|
||||
popd
|
||||
if /I not "%1"=="/PROJECTONLY" (
|
||||
pushd %BUILD_DIR_32%
|
||||
msbuild /m /p:Configuration=release /p:Platform=Win32 segatools.sln
|
||||
popd
|
||||
)
|
||||
)
|
||||
|
||||
:end (
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "unityhook/hook.h"
|
||||
|
||||
#include "util/dprintf.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static HMODULE mu3_hook_mod;
|
||||
static process_entry_t mu3_startup;
|
||||
@ -51,7 +52,7 @@ static DWORD CALLBACK mu3_pre_startup(void)
|
||||
|
||||
/* Load config */
|
||||
|
||||
mu3_hook_config_load(&mu3_hook_cfg, L".\\segatools.ini");
|
||||
mu3_hook_config_load(&mu3_hook_cfg, get_config_path());
|
||||
|
||||
/* Hook Win32 APIs */
|
||||
|
||||
@ -114,7 +115,7 @@ static DWORD CALLBACK mu3_pre_startup(void)
|
||||
|
||||
/* Initialize debug helpers */
|
||||
|
||||
spike_hook_init(L".\\segatools.ini");
|
||||
spike_hook_init(get_config_path());
|
||||
|
||||
dprintf("--- End mu3_pre_startup ---\n");
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "mu3io/ledoutput.h"
|
||||
|
||||
#include "util/dprintf.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static uint8_t mu3_opbtn;
|
||||
static uint8_t mu3_left_btn;
|
||||
@ -28,7 +29,7 @@ uint16_t mu3_io_get_api_version(void)
|
||||
|
||||
HRESULT mu3_io_init(void)
|
||||
{
|
||||
mu3_io_config_load(&mu3_io_cfg, L".\\segatools.ini");
|
||||
mu3_io_config_load(&mu3_io_cfg, get_config_path());
|
||||
|
||||
dprintf("XInput: --- Begin configuration ---\n");
|
||||
dprintf("XInput: Mouse lever emulation : %i\n", mu3_io_cfg.use_mouse);
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "platform/platform.h"
|
||||
|
||||
#include "util/dprintf.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static HMODULE swdc_hook_mod;
|
||||
static process_entry_t swdc_startup;
|
||||
@ -49,7 +50,7 @@ static DWORD CALLBACK swdc_pre_startup(void)
|
||||
|
||||
/* Config load */
|
||||
|
||||
swdc_hook_config_load(&swdc_hook_cfg, L".\\segatools.ini");
|
||||
swdc_hook_config_load(&swdc_hook_cfg, get_config_path());
|
||||
|
||||
/* Hook Win32 APIs */
|
||||
|
||||
@ -112,7 +113,7 @@ static DWORD CALLBACK swdc_pre_startup(void)
|
||||
|
||||
/* Initialize debug helpers */
|
||||
|
||||
spike_hook_init(L".\\segatools.ini");
|
||||
spike_hook_init(get_config_path());
|
||||
|
||||
dprintf("--- End swdc_pre_startup ---\n");
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "util/dprintf.h"
|
||||
#include "util/str.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static struct swdc_io_config swdc_io_cfg;
|
||||
static const struct swdc_io_backend *swdc_io_backend;
|
||||
@ -38,7 +39,7 @@ HRESULT swdc_io_init(void)
|
||||
return hr;
|
||||
}
|
||||
|
||||
swdc_io_config_load(&swdc_io_cfg, L".\\segatools.ini");
|
||||
swdc_io_config_load(&swdc_io_cfg, get_config_path());
|
||||
|
||||
if (wstr_ieq(swdc_io_cfg.mode, L"dinput")) {
|
||||
hr = swdc_di_init(&swdc_io_cfg.di, inst, &swdc_io_backend);
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "platform/platform.h"
|
||||
|
||||
#include "util/dprintf.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static HMODULE tokyo_hook_mod;
|
||||
static process_entry_t tokyo_startup;
|
||||
@ -39,7 +40,7 @@ static DWORD CALLBACK tokyo_pre_startup(void)
|
||||
|
||||
/* Load config */
|
||||
|
||||
tokyo_hook_config_load(&tokyo_hook_cfg, L".\\segatools.ini");
|
||||
tokyo_hook_config_load(&tokyo_hook_cfg, get_config_path());
|
||||
|
||||
/* Hook Win32 APIs */
|
||||
|
||||
@ -80,7 +81,7 @@ static DWORD CALLBACK tokyo_pre_startup(void)
|
||||
|
||||
/* Initialize debug helpers */
|
||||
|
||||
spike_hook_init(L".\\segatools.ini");
|
||||
spike_hook_init(get_config_path());
|
||||
|
||||
dprintf("--- End tokyo_pre_startup ---\n");
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "util/dprintf.h"
|
||||
#include "util/str.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static struct tokyo_io_config tokyo_io_cfg;
|
||||
static const struct tokyo_io_backend *tokyo_io_backend;
|
||||
@ -38,7 +39,7 @@ HRESULT tokyo_io_init(void)
|
||||
return hr;
|
||||
}
|
||||
|
||||
tokyo_io_config_load(&tokyo_io_cfg, L".\\segatools.ini");
|
||||
tokyo_io_config_load(&tokyo_io_cfg, get_config_path());
|
||||
|
||||
if (wstr_ieq(tokyo_io_cfg.mode, L"keyboard")) {
|
||||
hr = tokyo_kb_init(&tokyo_io_cfg.kb, &tokyo_io_backend);
|
||||
|
11
util/env.c
Normal file
11
util/env.c
Normal file
@ -0,0 +1,11 @@
|
||||
#include "env.h"
|
||||
|
||||
const wchar_t* get_config_path() {
|
||||
static wchar_t path[MAX_PATH];
|
||||
if (!GetEnvironmentVariableW(L"SEGATOOLS_CONFIG_PATH", path, MAX_PATH))
|
||||
{
|
||||
return L".\\segatools.ini";
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
4
util/env.h
Normal file
4
util/env.h
Normal file
@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
#include <windows.h>
|
||||
|
||||
const wchar_t* get_config_path();
|
@ -24,5 +24,7 @@ util_lib = static_library(
|
||||
'lib.h',
|
||||
'str.c',
|
||||
'str.h',
|
||||
'env.c',
|
||||
'env.h',
|
||||
],
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user