nba-emu / NanoBoyAdvance

A cycle-accurate Nintendo Game Boy Advance emulator.
GNU General Public License v3.0
974 stars 56 forks source link

[Feature request] Logging support #248

Open fleroviux opened 2 years ago

fleroviux commented 2 years ago

Emulators like mGBA and VBA allow logging from GBA code into a debugger/log window via a special hardware interface. This is useful for developing GBA homebrew. We may want to implement mGBA's logging interface for interoperability.

This was requested by GValiente on the GBADev Discord server.

fleroviux commented 1 year ago

Step 1 was completed in https://github.com/nba-emu/NanoBoyAdvance/commit/f85c7ed088b7323e6174fb9f481fb8b81c54661c. Now we just need a nice UI to display and filter the logs.

GValiente commented 1 year ago

Thanks for the feature!

It seems NBA takes too much time in flushing (showing printed lines), unlike mGBA, which flushes after each new line.

Also, it seems that old characters are not cleared when printing a new line.

mGBA output for this demo:

[WARN] GBA Debug: Log example
[WARN] GBA Debug: You can log characters: c
[WARN] GBA Debug: Numbers: 123
[WARN] GBA Debug: Bools: true
[WARN] GBA Debug: Pointers: 0x3007db4
[WARN] GBA Debug: Null pointers: nullptr
[WARN] GBA Debug: Always null pointers: nullptr
[WARN] GBA Debug: Multiple arguments: 1a2b3c
[WARN] GBA Debug: Even fixed point numbers: 0.12500
[WARN] GBA Debug: Custom types too: custom_type: 456

NBA output:

mGBA log: Log example
mGBA log: You can log characters: c
mGBA log: Numbers: 123characters: c
mGBA log: Bools: true3characters: c
mGBA log: Pointers: 0x3007db4ers: c
mGBA log: Null pointers: nullptr: c
mGBA log: Always null pointers: nullptr
mGBA log: Multiple arguments: 1a2b3cptr
mGBA log: Even fixed point numbers: 0.12500
mGBA log: Custom types too: custom_type: 456
fleroviux commented 1 year ago

@GValiente in the latest dev build both of these issues should be fixed now.

GValiente commented 1 year ago

@GValiente in the latest dev build both of these issues should be fixed now.

Are there public dev builds available?

fleroviux commented 1 year ago

@GValiente in the latest dev build both of these issues should be fixed now.

Are there public dev builds available?

Yes, you can download them either from https://nightly.link/nba-emu/NanoBoyAdvance/workflows/build/master or https://github.com/nba-emu/NanoBoyAdvance/actions.

GValiente commented 1 year ago

It works! Thanks.