mirror of
https://github.com/esuo1198/TaikoArcadeLoader.git
synced 2026-09-29 10:18:13 +03:00
Added Logger to TAL (#13)
* Added Logger for TAL with __VA_ARGS__ support * Added Tatacon entries in SDL DB * Added comments to exported config file * Included keys for LayeredFS * Cleaned up a bit of code in JPN39 patches * Formatted all files using clang-format * Force invalid cards on original readers You can now use any cards with the original namco readers. * Move helper functions to cpp file --------- Co-authored-by: ptmaster <lty2008one@163.com>
This commit is contained in:
committed by
Farewell_
co-authored by
ptmaster
parent
3933ecab00
commit
d0374dca1b
+13
-12
@@ -330,7 +330,7 @@ void
|
||||
SetConfigValue (toml_table_t *table, const char *key, Keybindings *keybind) {
|
||||
toml_array_t *array = toml_array_in (table, key);
|
||||
if (!array) {
|
||||
printWarning ("%s (%s): Cannot find array\n", __func__, key);
|
||||
LogMessage (LOG_LEVEL_WARN, (std::string (key) + ": Cannot find array").c_str ());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -395,16 +395,16 @@ InitializePoll (HWND windowHandle) {
|
||||
if (SDL_Init (SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER | SDL_INIT_EVENTS | SDL_INIT_VIDEO) == 0) {
|
||||
hasRumble = false;
|
||||
} else {
|
||||
printError ("SDL_Init (SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_EVENTS | SDL_INIT_VIDEO): "
|
||||
"%s\n",
|
||||
SDL_GetError ());
|
||||
LogMessage (LOG_LEVEL_ERROR,
|
||||
(std::string ("SDL_Init (SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_EVENTS | SDL_INIT_VIDEO): ")
|
||||
+ SDL_GetError ())
|
||||
.c_str ());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
auto configPath = std::filesystem::current_path () / "gamecontrollerdb.txt";
|
||||
if (SDL_GameControllerAddMappingsFromFile (configPath.string ().c_str ()) == -1)
|
||||
printError ("%s (): Cannot read gamecontrollerdb.txt\n", __func__);
|
||||
if (SDL_GameControllerAddMappingsFromFile (configPath.string ().c_str ()) == -1) LogMessage (LOG_LEVEL_ERROR, "Cannot read gamecontrollerdb.txt");
|
||||
SDL_GameControllerEventState (SDL_ENABLE);
|
||||
SDL_JoystickEventState (SDL_ENABLE);
|
||||
|
||||
@@ -413,15 +413,15 @@ InitializePoll (HWND windowHandle) {
|
||||
|
||||
SDL_GameController *controller = SDL_GameControllerOpen (i);
|
||||
if (!controller) {
|
||||
printWarning ("Could not open gamecontroller %s: %s\n", SDL_GameControllerNameForIndex (i), SDL_GetError ());
|
||||
LogMessage (LOG_LEVEL_WARN,
|
||||
(std::string ("Could not open gamecontroller ") + SDL_GameControllerNameForIndex (i) + ": " + SDL_GetError ()).c_str ());
|
||||
continue;
|
||||
}
|
||||
controllers[i] = controller;
|
||||
}
|
||||
|
||||
window = SDL_CreateWindowFrom (windowHandle);
|
||||
if (window == NULL) printError ("SDL_CreateWindowFrom (windowHandle): %s\n", SDL_GetError ());
|
||||
|
||||
if (window == NULL) LogMessage (LOG_LEVEL_ERROR, (std::string ("SDL_CreateWindowFrom (windowHandle): ") + SDL_GetError ()).c_str ());
|
||||
atexit (DisposePoll);
|
||||
|
||||
return hasRumble;
|
||||
@@ -454,8 +454,9 @@ UpdatePoll (HWND windowHandle) {
|
||||
|
||||
controller = SDL_GameControllerOpen (event.cdevice.which);
|
||||
if (!controller) {
|
||||
printError ("%s (): Could not open gamecontroller %s: %s\n", __func__, SDL_GameControllerNameForIndex (event.cdevice.which),
|
||||
SDL_GetError ());
|
||||
LogMessage (LOG_LEVEL_ERROR, (std::string ("Could not open gamecontroller ") + SDL_GameControllerNameForIndex (event.cdevice.which)
|
||||
+ ": " + SDL_GetError ())
|
||||
.c_str ());
|
||||
continue;
|
||||
}
|
||||
controllers[event.cdevice.which] = controller;
|
||||
@@ -548,7 +549,7 @@ StringToConfigEnum (const char *value) {
|
||||
return rval;
|
||||
}
|
||||
|
||||
printError ("%s (%s): Unknown value\n", __func__, value);
|
||||
LogMessage (LOG_LEVEL_ERROR, (std::string (value) + ": Unknown value").c_str ());
|
||||
return rval;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user