ckosmic / sm64ex-ios

iOS/tvOS port of https://github.com/sm64pc/sm64ex/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Render96ex support?

austinarchibald opened this issue · comments

I've got SM64 with Render96ex on my windows and linux machines (steam deck), but would be nice to have it on iOS! Throwing this out there for future development ideas... thanks!

If you put any files in the ios folder of this repo, they'll get copied directly to the app's root directory, so you're able to install Render96 model packs with DynOS:

  1. Download DynOS 1.0 from here and place DynOS.1.0.patch in the enhancements folder
  2. Patch the repo with DynOS 1.0: ./tools/apply_patch.sh enhancements/DynOS.1.0.patch (you may have to insert a couple lines manually if the patch rejects anything)
  3. In the iOS folder, create the following folders: dynos/packs/Render96
  4. Place all the .bin files from the Render96 model pack into here
  5. In Xcode, clean the build and rebuild, and it'll copy everything over and you'll be able to use model packs

Thanks for the help, that's great news!

In step 2, I get the following question File to patch:, I'm not sure what they're asking for here, bottom line:

austin@Blooper sm64ex-ios-ios % ./tools/apply_patch.sh enhancements/DynOS.1.0.patch
Do you wish to apply the patch 'enhancements/DynOS.1.0.patch'? [Y/N] Y
patching file Makefile
patching file 'data/dynos.c.h'
patching file 'data/dynos.cpp.h'
patching file 'data/dynos.h'
patching file 'data/dynos_c.cpp'
patching file 'data/dynos_gfx_init.cpp'
patching file 'data/dynos_gfx_load.cpp'
patching file 'data/dynos_gfx_read.cpp'
patching file 'data/dynos_gfx_texture.cpp'
patching file 'data/dynos_gfx_update.cpp'
patching file 'data/dynos_gfx_write.cpp'
patching file 'data/dynos_level.cpp'
patching file 'data/dynos_main.cpp'
patching file 'data/dynos_misc.cpp'
patching file 'data/dynos_opt.cpp'
patching file 'data/dynos_opt_config.cpp'
patching file 'data/dynos_opt_cont.cpp'
patching file 'data/dynos_opt_render.cpp'
patching file 'data/dynos_opt_vanilla.cpp'
patching file 'data/dynos_opt_vanilla_c.c'
patching file 'data/dynos_sanity.c'
patching file 'data/dynos_warps.cpp'
patching file dynos.mk
patching file 'include/types.h'
patching file 'src/audio/seqplayer.c'
patching file 'src/engine/geo_layout.c'
patching file 'src/engine/level_script.c'
patching file 'src/game/behaviors/ddd_pole.inc.c'
patching file 'src/game/behaviors/ddd_sub.inc.c'
File to patch: 

Also, in step 4, can I include the texture pack? Would I put into src/pc/gfx? (edit: or maybe ios/res/gfx to stay consistent with your instructions for the model pack)

Update: I think I figured out the File to patch is the rom. I put it as baserom.us.z64. But 3 hunks failed:

File to patch: baserom.us.z64
patching file baserom.us.z64
3 out of 3 hunks failed--saving rejects to baserom.us.z64.rej
patching file 'src/game/object_helpers.c'
patching file 'src/game/options_menu.c'
patching file 'src/game/rendering_graph_node.c'
patching file 'src/pc/gfx/gfx_pc.c'

Any ideas here? You suspected there may be rejects, so what lines do I need to insert, and where do I do this? Thanks so much for your help!

Here's baserom.us.z64.rej

@@ -2,4 +2,5 @@
 
 #include "sm64.h"
+#include "data/dynos.c.h"
 #include "gfx_dimensions.h"
 #include "audio/external.h"
@@ -385,7 +386,4 @@
 // input list until it is complete. called every frame.
 void run_demo_inputs(void) {
-    // eliminate the unused bits.
-    gControllers[0].controllerData->button &= VALID_BUTTONS;
-
     /*
         Check if a demo inputs list
@@ -456,4 +454,5 @@
         osRecvMesg(&gSIEventMesgQueue, &D_80339BEC, OS_MESG_BLOCK);
         osContGetReadData(&gControllerPads[0]);
+        dynos_update_opt((void *) &gControllerPads[0]);
     }
     run_demo_inputs();

The file it's rejecting is src/game/game_init.m, so in src/game/game_init.m, add

#include "data/dynos.c.h"

at the top of the file. Remove

// eliminate the unused bits.
gControllers[0].controllerData->button &= VALID_BUTTONS;

from the run_demo_inputs function. Lastly, add

dynos_update_opt((void *) &gControllerPads[0]);

in the read_controller_inputs function at the end of the first if statement. The reject file will give you an idea of where to make these changes.

For texture packs, I realize I messed up getting external data from the res folder to work in the main branch, so I recommend using the apple_silicon_fix branch where I've updated how external resources are handled. They'll be read from the Files app under "On My iPhone > Super Mario 64 > res" instead so you'll be able to add/remove model/sound/texture packs straight from the phone without having to rebuild the entire app. Also in Build Settings, you'll need to add a user-defined setting named "EXTERNAL_DATA" and set its value to 1.

Let me know if you run into any issues using the apple_silicon_fix branch as I've only tested it in my environment.

Really appreciate the help. Using the apple_silicon_fix branch, I made those changes to src/game/game_init.m saved it, and applied patch. The rej file is acting as if those changes aren't there, but I know they are! It's strange. I put them exactly where the .rej said to. This is the new .rej file, looks like the one where there are no changes to src/game/game_init.m.

@@ -2,4 +2,5 @@
 
 #include "sm64.h"
+#include "data/dynos.c.h"
 #include "gfx_dimensions.h"
 #include "audio/external.h"
@@ -385,7 +386,4 @@
 // input list until it is complete. called every frame.
 void run_demo_inputs(void) {
-    // eliminate the unused bits.
-    gControllers[0].controllerData->button &= VALID_BUTTONS;
-
     /*
         Check if a demo inputs list
@@ -456,4 +454,5 @@
         osRecvMesg(&gSIEventMesgQueue, &D_80339BEC, OS_MESG_BLOCK);
         osContGetReadData(&gControllerPads[0]);
+        dynos_update_opt((void *) &gControllerPads[0]);
     }
     run_demo_inputs();

You can see my src/game/game_init.m here.

Thanks again.

That's fine, as long as the changes are there then it should work as expected.

Ok, I think I did everything correctly. I followed these instructions, but with your additional notes, like EXTERNAL_DATA, copying res folder to iPhone, etc. However, Build failed. The text in red, under object_helpers is: no member named 'georef' in 'struct GraphNode', repeated twice. Sorry to keep bugging you!

image

No worries! Before applying the patch and changes, does the app compile successfully? Also are you on an Intel mac or M1/M2 mac? You can check by clicking the Apple icon in the status bar and choosing "About This Mac". It's been a while since I've tried building on an Intel mac so I'm not entirely sure if the Apple silicon fixes broke anything for it.