Possible ESP32 Doom port for GO?

Moderators: mdrjr, odroid

Re: Possible ESP32 Doom port for GO?

Unread postby mad_ady » Wed Aug 01, 2018 12:36 am

Doom overwrites go-play (the emulators), but not the actual games.
User avatar
mad_ady
 
Posts: 4265
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Possible ESP32 Doom port for GO?

Unread postby jutleys » Wed Aug 01, 2018 1:07 am

Yes the games are still there on the card but they wont show on the menu only for nes all others are fine and then the device just freezes. The only way out is to turn off and on if i delete all the games and recopy them its all working again. This could be a bug in the firmware its now happened 3 times to me now since the latest firmware update.
jutleys
 
Posts: 51
Joined: Fri Jul 20, 2018 1:06 am
languages_spoken: english
ODROIDs: Odroid Go

Re: Possible ESP32 Doom port for GO?

Unread postby crashoverride » Wed Aug 01, 2018 6:51 am

mad_ady wrote:is this because I'm not using mutex-es as you suggested?

The log output would suggest that it is.
Code: Select all
E (16767) sdmmc_cmd: sdmmc_read_sectors_dma: sdmmc_send_cmd returned 0x107
E (16767) diskio_sdmmc: sdmmc_read_blocks failed (263)


An example of using a mutex is here:
https://github.com/OtherCrashOverride/go-play/blob/1953f92b8f98f9723f87f0369c0400da7704cad6/odroid-go-common/components/odroid/odroid_display.c#L1338-L1359

https://github.com/OtherCrashOverride/go-play/blob/1953f92b8f98f9723f87f0369c0400da7704cad6/odroid-go-common/components/odroid/odroid_display.c#L415
https://github.com/OtherCrashOverride/go-play/blob/1953f92b8f98f9723f87f0369c0400da7704cad6/odroid-go-common/components/odroid/odroid_display.c#L563

jutleys wrote:The only way out is to turn off and on if i delete all the games and recopy them its all working again.

Try removing unused/seldom used ROM from the NES folder. Also keep the file names as short as possible.

Since the file list is sorted, it is necessary to load all the file names into memory. After this a 'quick sort' is performed. This algorithm, like all fast sorts, is recursive: it takes more memory depending on how 'unsorted' the list is. Deleting and re-copying games changes this 'natural order' and that is why it affects success. Adding, erasing, or renaming a file will also affect success. Testing is done with 2,724 files in the NES folder.
crashoverride
 
Posts: 3864
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1

Re: Possible ESP32 Doom port for GO?

Unread postby mad_ady » Wed Aug 01, 2018 12:39 pm

Thanks for the examples. I will try to implement it when I return from holiday.

A few more questions please:
* it seems you have a mutex (and duplicated mutex set/unset code for each emulator. Isn't this redundant? Wouldn't one mutex have sufficed?
* in addition to setting/unsetting the mutex on display operation, I need to do the same on sd card operation, (fopen, fread, fclose, etc), right?

I'm not sure why saving a game didn't trigger a crash (maybe the screen was not being refreshed constantly while in menu?)...

One more thing - If I undo the changes and start reading the wad from sd I will inflict a huge performance drop because of the need to use locks while reading a 4M file from sd and also because the spi bus is shared between psram, lcd and sd - am I right? Internal flash does not use the same spi bus?

Thanks
User avatar
mad_ady
 
Posts: 4265
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Possible ESP32 Doom port for GO?

Unread postby crashoverride » Wed Aug 01, 2018 2:16 pm

mad_ady wrote:Wouldn't one mutex have sufficed?

Yes. There is no reason for multiple since the GB, SMS, and NES display code is never used simultaneously.

mad_ady wrote:I need to do the same on sd card operation, (fopen, fread, fclose, etc), right?

Yes. Lock the mutex. Do your file operations. Unlock the mutex.

mad_ady wrote:If I undo the changes and start reading the wad from sd I will inflict a huge performance drop because of the need to use locks while reading a 4M file from sd and also because the spi bus is shared between psram, lcd and sd - am I right? Internal flash does not use the same spi bus?

This is done in the GB/GBC to demand load (16K segments) from the ROM file. It causes a slight pause. The PSRAM shares a SPI bus with flash. The LCD shares a different SPI bus with SD card.
crashoverride
 
Posts: 3864
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1

Re: Possible ESP32 Doom port for GO?

Unread postby mad_ady » Mon Aug 06, 2018 3:02 pm

@crashoverride: in order to do faster testing than copying and flashing fw to sd and flashing from device firmware I think I can erase and flash only the application partition over usb without clobbering device firmware or wad. I know that partition is 1M but what are its offsets? And can I write the bin file directly without making it a fw?
Thanks
User avatar
mad_ady
 
Posts: 4265
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Possible ESP32 Doom port for GO?

Unread postby crashoverride » Mon Aug 06, 2018 3:26 pm

mad_ady wrote:I think I can erase and flash only the application partition over usb without clobbering device firmware or wad.

I do this in go-play for each emulator during development. I use a script to flash it to the correct offset:
https://github.com/OtherCrashOverride/go-play/blob/master/nesemu-go/flashapp.sh
Code: Select all
. ${IDF_PATH}/add_path.sh
esptool.py --chip esp32 --port "/dev/ttyUSB0" --baud 921600 write_flash -fs detect --flash_freq 40m --flash_mode qio 0x200000 build/nesemu-go.bin


mad_ady wrote:I know that partition is 1M but what are its offsets?

The offset is not fixed anymore and is subject to change with each device firmware release. Currently its 0x100000:
https://github.com/OtherCrashOverride/odroid-go-firmware/blob/9c0cee323675f52178e0884d2dff26e35d84de51/partitions.csv#L7

mad_ady wrote:And can I write the bin file directly without making it a fw?

Yes, adapt the scripts from go-play. Change the "0x200000 build/nesemu-go.bin" at the end to "0x100000 build/esp32-doom.bin"
crashoverride
 
Posts: 3864
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1

Re: Possible ESP32 Doom port for GO?

Unread postby mad_ady » Mon Aug 06, 2018 8:02 pm

Thanks again. In a few days I'll return from holiday and start fresh
User avatar
mad_ady
 
Posts: 4265
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Possible ESP32 Doom port for GO?

Unread postby mad_ady » Sat Aug 11, 2018 12:07 am

Ok - progress report: I managed to replicate safe flashing over usb - this sped up testing considerably!

Regarding the use of mutexes - I reused most of crashoverride's work (as usual) and so far it compiles and runs. I was unable to test because I somehow broke
sd card support (the sd card init code reports that the bus has been initialized already). Need to dig further...
User avatar
mad_ady
 
Posts: 4265
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Possible ESP32 Doom port for GO?

Unread postby crashoverride » Sat Aug 11, 2018 12:13 am

mad_ady wrote:the sd card init code reports that the bus has been initialized already

Make sure you are using the forked ODROID-GO esp-idf:
https://github.com/OtherCrashOverride/esp-idf/tree/release/v3.1-odroid
crashoverride
 
Posts: 3864
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1

Re: Possible ESP32 Doom port for GO?

Unread postby mameise » Sat Aug 11, 2018 1:00 am

Lol everytime when there is a new post here i already cross the fingers mad_ady made it :) DOOM is now the game i play most on the Odroid-go.
mameise
 
Posts: 72
Joined: Sat Jul 07, 2018 6:40 am
languages_spoken: english german
ODROIDs: ODROID-GO

Re: Possible ESP32 Doom port for GO?

Unread postby mad_ady » Sat Aug 11, 2018 2:45 am

I am using the forked environment - must have made some stupid mistake I need to figure out next week.

@mameise: That's my most played game too. But due to my lack of C expertise, lack of time and incomplete understanding of the code, things are slow to progress. But where's a will, there's a way...

Most of my commands are around grep -R keyword * to look where things are
User avatar
mad_ady
 
Posts: 4265
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Possible ESP32 Doom port for GO?

Unread postby jutleys » Sat Aug 11, 2018 10:21 pm

We need a wolf3d port like this would love it
jutleys
 
Posts: 51
Joined: Fri Jul 20, 2018 1:06 am
languages_spoken: english
ODROIDs: Odroid Go

Re: Possible ESP32 Doom port for GO?

Unread postby mad_ady » Sat Aug 11, 2018 11:51 pm

Once the engine works as expected I will experiment with various wads (full doom, doom2, etc). I'm hoping there's a wolfstein wad as well. Hexen should probably work too.
Maybe you can track down the wads in the mean time :)
User avatar
mad_ady
 
Posts: 4265
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Possible ESP32 Doom port for GO?

Unread postby jutleys » Sun Aug 12, 2018 2:10 am

mad_ady wrote:Once the engine works as expected I will experiment with various wads (full doom, doom2, etc). I'm hoping there's a wolfstein wad as well. Hexen should probably work too.
Maybe you can track down the wads in the mean time :)

I have a good collection of wads including strife etc let me know what you need.
jutleys
 
Posts: 51
Joined: Fri Jul 20, 2018 1:06 am
languages_spoken: english
ODROIDs: Odroid Go

Re: Possible ESP32 Doom port for GO?

Unread postby rooted » Sun Aug 12, 2018 4:44 am

jutleys wrote:I have a good collection of wads...


That's a hilarious statement in itself :)
User avatar
rooted
 
Posts: 5318
Joined: Fri Dec 19, 2014 9:12 am
Location: Gulf of Mexico, US
languages_spoken: english
ODROIDs: C1, C1+, C2
XU3 Lite, XU4
N1
VU7+
HiFi Shield 2
Smart Power (original)

Re: Possible ESP32 Doom port for GO?

Unread postby mad_ady » Wed Aug 15, 2018 9:57 pm

Ok, I've retraced my steps and checked the code and it seems that:
1. SD card support is loaded ok
2. Writing a save game is ok (file of the reported size is created but I haven't validated its contents). I'm using the mutex when writing files
3. Reading a save game is not ok. It crashes with these messages (the crash is not the problem, but failing to read the file is):
Code: Select all
M_DoSaveGame: About to write file with name /sd/odroid/data/doom/prbmsav2.ds, length 39354
M_DoSaveGame: Write result: 1
M_Responder: Processing ch -1
M_Responder: Processing ch -1
M_Responder: Processing ch 174
M_Responder: Processing ch 173
M_Responder: Processing ch -1
M_Responder: Processing ch 174
M_Responder: Processing ch -1
M_Responder: Processing ch 172
M_Responder: Processing ch -1
M_Responder: Processing ch -1
M_Responder: Processing ch 172
M_Responder: Processing ch -1
M_Responder: Processing ch 27
M_Responder: Processing ch -1
M_Responder: Processing ch 173
M_Responder: Processing ch -1
M_Responder: Processing ch 157
M_Responder: Processing ch 13
M_LoadGame choice 2... demorecording=0, compatibility_level=17, prboom_2_compatibility=13
M_LoadSelect: selected choice 2
G_LoadGame: slot 2, command 0
G_DoLoadGame...
G_DoLoadGame: About to call G_SaveGameName(name,33,2,0)
G_DoLoadGame: About to call M_ReadFile(/sd/odroid/data/doom/prbmsav2.ds, savebuffer)
Attempting M_ReadFile /sd/odroid/data/doom/prbmsav2.ds
E (34675) sdmmc_cmd: sdmmc_read_sectors_dma: sdmmc_send_cmd returned 0x107
E (34675) diskio_sdmmc: sdmmc_read_blocks failed (263)
M_ReadFile: fopen returned errorCouldn't read file /sd/odroid/data/doom/prbmsav2.ds: (Unknown Error)

abort() was called at PC 0x400e2653 on core 0



The M_ReadFIle function begins here: https://github.com/mad-ady/doom-odroid- ... isc.c#L118

I don't know why it can't open a file for reading... Any ideas/suggestions?
User avatar
mad_ady
 
Posts: 4265
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Possible ESP32 Doom port for GO?

Unread postby mad_ady » Wed Aug 15, 2018 10:12 pm

I made a new change and tried to read the filesize using crashoverride's "library" code and it fails in the same way:
Code: Select all
G_DoLoadGame: About to call M_ReadFile(/sd/odroid/data/doom/prbmsav2.ds, savebuffer)
Attempting M_ReadFile /sd/odroid/data/doom/prbmsav2.ds
E (25145) sdmmc_cmd: sdmmc_read_sectors_dma: sdmmc_send_cmd returned 0x107
E (25145) diskio_sdmmc: sdmmc_read_blocks failed (263)
odroid_sdcard_get_filesize: fopen failed.
File /sd/odroid/data/doom/prbmsav2.ds has size 0
E (25155) sdmmc_cmd: sdmmc_read_sectors_dma: sdmmc_send_cmd returned 0x107
E (25165) diskio_sdmmc: sdmmc_read_blocks failed (263)
M_ReadFile: fopen returned error
Couldn't read file /sd/odroid/data/doom/prbmsav2.ds: (Unknown Error)

abort() was called at PC 0x400e265f on core 0


I'm a bit stuck....

Maybe the mutex doesn't work as I expected, because it would crash when trying to read the save game before adding mutexes as well. I was under the impression that the mutex saves it state in a global variable. But I'm including (and calling) the set/unset code from a bunch of places - maybe there is some kind of namespace thing that I don't know about and the mutex does not actually work? In order to find out I'll need to printf my way in the mutex, but that will slow everything down and also cause the output to be filled with all kinds of messages...
User avatar
mad_ady
 
Posts: 4265
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Possible ESP32 Doom port for GO?

Unread postby mad_ady » Thu Aug 16, 2018 10:35 pm

Ok, here's a new release: https://github.com/mad-ady/doom-odroid- ... g/20180816

It remaps keys for better play experience. It also adds support for cheat codes (yay!). Save seems to work but load game is still broken... Need to see what I can do about it in the future... Cheat codes suggestions are welcome.
User avatar
mad_ady
 
Posts: 4265
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Possible ESP32 Doom port for GO?

Unread postby mameise » Thu Aug 16, 2018 11:13 pm

Cool :) Need to test it later. But how would we enter cheats? Found this page:

http://www.mogelpower.de/cheats/Doom--_PC_330.html

Seems to be quite complete. It is in german so i hope it is understandable.
The site also mentions a loadgame line parameter. Could that help with the loading issues?
Did not count but i start the game all over again several times a day so commulated for sure near the hundret times already.
:) Loading would be absolutely amazing still. I also realised it is not possible to play hardest because you need to extra confirm. Can you also remove this additional confirmation by chance?
mameise
 
Posts: 72
Joined: Sat Jul 07, 2018 6:40 am
languages_spoken: english german
ODROIDs: ODROID-GO

Re: Possible ESP32 Doom port for GO?

Unread postby mad_ady » Thu Aug 16, 2018 11:47 pm

Yes, removing (or injecting) that Y is on my todo list. But makes sense only with codes enabled.

Inputting codes is explained on the release page. Basically combinations of Menu + DPAD or Volume + DPAD. It may also toggle the menu or map.

I changed B from "use" because it's rarely used. I replaced it with run/strafe because you need to do that more often.

Load game fails because it fails to open the file for some reason. I'll look into it tomorrow some more...

One good news is I found out in the code that the levels are pre-loaded, which means that when we add loading of WADs from SD there shouldn't be a performance drop in game play (maybe slightly slower level load).
User avatar
mad_ady
 
Posts: 4265
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Possible ESP32 Doom port for GO?

Unread postby mameise » Fri Aug 17, 2018 3:33 am

Ok i did not click on your link. Amazing job! Already installed it now. The switch of b and also the other changes really improve gameplay! The solution for the cheats is also extremely nice. But would it be possible to add some buttonpressdelay? I tried to activate berserk mode and realized it switched on and off in miliseconds.
mameise
 
Posts: 72
Joined: Sat Jul 07, 2018 6:40 am
languages_spoken: english german
ODROIDs: ODROID-GO

Re: Possible ESP32 Doom port for GO?

Unread postby mad_ady » Fri Aug 17, 2018 12:43 pm

Yes, that's a bit tricky. I guess I could store the current time in some global variables and compare it with the last toggle time and run the code only if the gap is > 500ms or similar. I'll try.
User avatar
mad_ady
 
Posts: 4265
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Previous

Return to General Chat

Who is online

Users browsing this forum: mameise and 2 guests