kodi-game / game.libretro

Libretro compatibility layer for the Kodi Game API
GNU General Public License v2.0
37 stars 26 forks source link

Fix add-on using console to log #109

Closed garbear closed 1 year ago

garbear commented 1 year ago

Description

This PR fixes using the console to log. Instead, we should use Kodi APIs.

Console logging was added for the CI script in case it needed to run code here in a shell. However, we currently don't do this. Also, we should use the add-on API to log inside an add-on. Therefore, fixing the logging pipe is the best approach.

How has this been tested?

Tested by pushing keyboard keys inside DOSBox, which previously didn't log the debug output in console mode. After applying the patch, debug log lines successfully log:

debug <general>: Keyboard: scancode: 0x30, sym: 0x62, unicode: 0x62, modifier: 0x0
debug <general>: AddOnLog: game.libretro.dosbox: Controller "game.controller.keyboard" key "b" (RETROK_b) modifier 0x00000000: down
debug <general>: Keyboard: scancode: 0x30, sym: 0x62, unicode: 0x00, modifier: 0x0
debug <general>: AddOnLog: game.libretro.dosbox: Controller "game.controller.keyboard" key "b" (RETROK_b) modifier 0x00000000: up
debug <general>: Keyboard: scancode: 0x30, sym: 0x62, unicode: 0x62, modifier: 0x0
debug <general>: AddOnLog: game.libretro.dosbox: Controller "game.controller.keyboard" key "b" (RETROK_b) modifier 0x00000000: down
debug <general>: Keyboard: scancode: 0x30, sym: 0x62, unicode: 0x00, modifier: 0x0
debug <general>: AddOnLog: game.libretro.dosbox: Controller "game.controller.keyboard" key "b" (RETROK_b) modifier 0x00000000: up
debug <general>: Keyboard: scancode: 0x1e, sym: 0x61, unicode: 0x61, modifier: 0x0
debug <general>: AddOnLog: game.libretro.dosbox: Controller "game.controller.keyboard" key "a" (RETROK_a) modifier 0x00000000: down
debug <general>: Keyboard: scancode: 0x1e, sym: 0x61, unicode: 0x00, modifier: 0x0
debug <general>: AddOnLog: game.libretro.dosbox: Controller "game.controller.keyboard" key "a" (RETROK_a) modifier 0x00000000: up
debug <general>: Keyboard: scancode: 0xd, sym: 0x3d, unicode: 0x3d, modifier: 0x0
debug <general>: AddOnLog: game.libretro.dosbox: Controller "game.controller.keyboard" key "equals" (RETROK_EQUALS) modifier 0x00000000: down
debug <general>: Keyboard: scancode: 0xd, sym: 0x3d, unicode: 0x00, modifier: 0x0
debug <general>: AddOnLog: game.libretro.dosbox: Controller "game.controller.keyboard" key "equals" (RETROK_EQUALS) modifier 0x00000000: up