Skip to content

Add AAsset_seek_impl#20

Closed
JeodC wants to merge 1 commit intoPortsMaster:masterfrom
JeodC:AAsset_seek_impl
Closed

Add AAsset_seek_impl#20
JeodC wants to merge 1 commit intoPortsMaster:masterfrom
JeodC:AAsset_seek_impl

Conversation

@JeodC
Copy link

@JeodC JeodC commented Mar 24, 2025

This PR adds AAsset_seek_impl which is a reimplementation of AAsset_seek.

@JeodC JeodC requested review from JohnnyonFlame and cdeletre March 24, 2025 20:03
@JeodC JeodC changed the title Add AAsset_seek_impl and several memory cleanups/safety checks Add AAsset_seek_impl Mar 26, 2025
@JeodC
Copy link
Author

JeodC commented Mar 26, 2025

After thorough testing and rewriting, I have simplified the commits here and ensured backwards compatibility. The AAsset struct now features a persistent_read boolean which inits to false, and is set to true if AAsset_seek is called. In addition, in order to retain compatibility with some ports, I reverted a commit that stubbed all extensions--they now load natively as expected.

The following ports were tested with this build:

  • Dokimon
  • UFO 50
  • Victory Heat Rally
  • Dark Deity 2 (known to use AAsset_seek)
  • Zelda II Enhanced (armhf)

All boot and play as expected.

@JeodC JeodC changed the title Add AAsset_seek_impl Add AAsset_seek_impl and organize stubs Mar 26, 2025
@JeodC
Copy link
Author

JeodC commented Mar 26, 2025

Latest commit moves stubs into a new subfolder, with stubs_gameframe.cpp and stubs_steam.cpp to keep libyoyo.cpp tidy.

@JeodC
Copy link
Author

JeodC commented Mar 26, 2025

I would like someone else to check over my work here before merging. Dark Deity 2 boots, but is unable to load into a level properly:

texture_is_ready(): Texture group TG_Transitions not found
texture_prefetch(): Texture group TG_Transitions not found
texture_prefetch(): Texture group TG_combatoverlay not found
AAsset_seek_impl: seek offset 651344125719283977 out of bounds (size=2655611)
/storage/roms/ports/Dark Deity 2.sh: line 54: 32738 Segmentation fault      (core dumped) ./gmloadernext.aarch64 -c gmloader.json

I had it working prior a cleanup and backwards compatibility rewrite, so I might be missing something.

@JeodC
Copy link
Author

JeodC commented Mar 26, 2025

I would like someone else to check over my work here before merging. Dark Deity 2 boots, but is unable to load into a level properly:

texture_is_ready(): Texture group TG_Transitions not found
texture_prefetch(): Texture group TG_Transitions not found
texture_prefetch(): Texture group TG_combatoverlay not found
AAsset_seek_impl: seek offset 651344125719283977 out of bounds (size=2655611)
/storage/roms/ports/Dark Deity 2.sh: line 54: 32738 Segmentation fault      (core dumped) ./gmloadernext.aarch64 -c gmloader.json

I had it working prior a cleanup and backwards compatibility rewrite, so I might be missing something.

Latest commit resolved this and I verified it works with other gms ports as well. In summary, the issue appeared to initially be:

  • Gmloader would open an asset and make it persistent
  • The game would successfully read the asset, but would then try to seek a different asset
  • Gmloader did not change to the new asset, resulting in the out of bounds error (most likely due to having an ogg file open and then trying to seek the much larger data.win)

Now the asset closes when done seeking giving us a clean slate.

@JeodC JeodC marked this pull request as draft April 10, 2025 12:31
@JeodC
Copy link
Author

JeodC commented Apr 10, 2025

Converting to draft, will rebase off gamechange branch once merged.

@JeodC JeodC changed the title Add AAsset_seek_impl and organize stubs Add AAsset_seek_impl Apr 25, 2025
@JeodC JeodC marked this pull request as ready for review April 25, 2025 02:44
@JeodC
Copy link
Author

JeodC commented Apr 25, 2025

Also cherry picked upstream

@JeodC JeodC closed this Apr 25, 2025
@JeodC JeodC deleted the AAsset_seek_impl branch April 25, 2025 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant