3
0
mirror of https://github.com/CrazyRedMachine/popnhax.git synced 2024-11-24 06:10:12 +01:00

exit on xml parsing fail, xml rewrite

This commit is contained in:
CrazyRedMachine 2023-07-30 18:17:59 +02:00
parent 1716103d34
commit 6950deeccb
3 changed files with 19 additions and 7 deletions

View File

@ -26,7 +26,7 @@
<!-- Premium free (unlimited stages per credit) --> <!-- Premium free (unlimited stages per credit) -->
<pfree __type="bool">0</pfree> <pfree __type="bool">0</pfree>
<!-- Press numpad 9 in song to retire instantly, or on result screen to leave game session (thank you for playing) --> <!-- Press numpad 9 in song to retire instantly, or on result screen to leave game session (thank you for playing) -->
<!-- quick_retire with pfree also enables quick retry: press numpad 8 during song or on result screen to retry (keep holding during option select to skip it) --> <!-- quick_retire with pfree also enables quick retry: press numpad 8 during song or on result screen to retry (keep holding to skip option select) -->
<quick_retire __type="bool">0</quick_retire> <quick_retire __type="bool">0</quick_retire>
<!-- Network features --> <!-- Network features -->
@ -59,17 +59,22 @@
<!-- HD resolution for pcb_type=0 (0: no, 1: keep texts as on HD cab (smaller LCD mod), 2: center texts (32" LCD mod) ) --> <!-- HD resolution for pcb_type=0 (0: no, 1: keep texts as on HD cab (smaller LCD mod), 2: center texts (32" LCD mod) ) -->
<force_hd_resolution __type="u8">0</force_hd_resolution> <force_hd_resolution __type="u8">0</force_hd_resolution>
<!-- END OF USER SETTINGS --> <!-- ====================
END OF USER SETTINGS
==================== -->
<!-- EXPERIMENTAL PATCHES --> <!-- EXPERIMENTAL PATCHES -->
<!-- Enable practice mode menu, (r-ran, constant chart speed, slow motion, etc...) --> <!-- Enable practice mode menu, (r-ran, constant chart speed, slow motion, etc...) -->
<!-- PLEASE USE OFFLINE ONLY --> <!-- PLEASE USE OFFLINE ONLY -->
<practice_mode __type="bool">0</practice_mode> <practice_mode __type="bool">0</practice_mode>
<!-- Press 9 on option select screen to go back to song selection (requires pfree and quick_retire) --> <!-- Press 9 on option select screen to go back to song selection (requires quick_retire) -->
<!-- Note: causes issues with sounds on song select --> <!-- Note: causes issues with sounds on song select -->
<back_to_song_select __type="bool">0</back_to_song_select> <back_to_song_select __type="bool">0</back_to_song_select>
<!-- DEBUG OPTIONS FOLLOW (GENERALLY SHOULD NOT BE CHANGED UNLESS YOU KNOW WHAT YOU'RE DOING) -->
<!-- ========================================================================================
DEBUG OPTIONS FOLLOW (GENERALLY SHOULD NOT BE CHANGED UNLESS YOU KNOW WHAT YOU'RE DOING)
======================================================================================== -->
<!-- Datecode and Multiboot --> <!-- Datecode and Multiboot -->
<!-- Force a different datecode than the one found in ea3-config (yyyymmdd00) --> <!-- Force a different datecode than the one found in ea3-config (yyyymmdd00) -->

View File

@ -3897,7 +3897,11 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
LOG("popnhax: game dll: %s\n",g_game_dll_fn); LOG("popnhax: game dll: %s\n",g_game_dll_fn);
LOG("popnhax: config file: %s\n",g_config_fn); LOG("popnhax: config file: %s\n",g_config_fn);
_load_config(g_config_fn, &config, config_psmap); if (!_load_config(g_config_fn, &config, config_psmap))
{
LOG("FATAL ERROR: Could not parse %s\n", g_config_fn);
return FALSE;
}
if (force_trans_debug) if (force_trans_debug)
config.translation_debug = true; config.translation_debug = true;

View File

@ -84,17 +84,20 @@ struct property *load_prop_file(const char *filename) {
return config_data; return config_data;
} }
void _load_config(const char *filename, void *dest, const struct property_psmap *psmap) { bool _load_config(const char *filename, void *dest, const struct property_psmap *psmap) {
struct property *config_xml = load_prop_file(filename); struct property *config_xml = load_prop_file(filename);
if (!config_xml) { if (!config_xml) {
printf("Couldn't load xml file: %s\n", filename); printf("Couldn't load xml file: %s\n", filename);
return; return false;
} }
if (!(property_psmap_import(config_xml, nullptr, dest, psmap))) { if (!(property_psmap_import(config_xml, nullptr, dest, psmap))) {
printf("Couldn't parse psmap\n"); printf("Couldn't parse psmap\n");
return false;
} }
return true;
} }
#endif #endif