* place plugin suprx file into ux0:plugins/
* edit game.txt in same directory to include line: "ux0:plugins/dukemod.suprx 1"
* start a supported dump of Duke3D
SHA1 hash of EBOOT.BIN from a dump (made with old version of Vitamin) that is guaranteed to work with the plugin:
Code: Select all
When you get into the actual game, you can use the touchscreen to switch weapons quickly. The edges of the screen are divided into 4 equally sized sections, left edge is for weapons 3-6 (shotgun to pipebomb) and right edge is for weapons 7-10 (shrinker/grower to freezer). Center of the screen is for weapon 2 (pistol). There is no touch location for the foot, at least not for now. Place your finger on screen, if necessary move it around until the weapon number you see is the one you wanted to switch to, release finger and the weapon will be switched.
Currently the switching is implemented in a way which sometimes causes a small delay before the switch actually happens, I'll try to fix this later. The only debugging text you see currently (if you don't disable it on startup) is related to this, the plugin will tell you it's waiting for the weapon change in game code to start or end.
The switcher is also not currently disabled when you're not actually in game (but in menus or watching a demo / "user clip", between levels, etc...) and you can break things with this, will be fixed later.
Currently, the game's own touchscreen inputs (touching the left or right half of screen can be bound to an action in game) aren't disabled so bind something that doesn't get in the way when switching weapons to them. eg. I currently have quick kick bound to left half of screen and show scoreboard (does nothing in single player) bound to right half of screen in the game's own input configuration settings. I'll try to figure out a way to disable the inputs via memory patching or savedata config file hack ASAP.
Plugin source code will be released eventually when it's more complete.
Since there is no homebrew Duke 3D port for the Vita yet (and who knows if there ever will be anything or even a good port, Duke/Build codebase is not that clean and nice to work on or as easily portable as for example id's games are...), I thought I'd try to add some improvements to the reasonably well working closed source, official port we already have.
So far I've got a plugin that works with one version of the game (EU, unpatched I think, dumped with Vitamin 1.0) and allows quick switching of weapons from the touchscreen (and also disables graphics filtering but I'll make this optional later). Other features I've been thinking about would be quick weapon switching with analog sticks (via a weapon wheel or something) for Vita TV users, loading user maps and mods and accessing all PC version cheats (all the code is still there, it's just not possible to activate them).
Making multiplayer work without PSN would be nice too, but not a high priority for me (and possibly will be more difficult than what I listed above, but I have to see about that).
If anyone has any other feature suggestions, I'd like to hear them.
If you have any tips on how to get IDA to show names for sce* OS/library calls in dumped game ELFs, I'm interested. vitadump.py fixes a lot of the data references but I'm not seeing any function names... Oh well, at least Duke isn't that hard to hack regardless because partial source code available.
If you have any tips on how to patch game code on the fly from a plugin thread, I'm interested. Patching data is ok, but patching code will always cause a crash, I guess because executable memory is write protected. AFAIK HENkaku should at least allow allocating new blocks of writable+executable memory due to emulator coders requiring this for JIT. But can I change permissions for memory that the OS allocated for the game binary on startup somehow?
If you have any tips on how to deal with ASLR/relocation in a plugin thread that's supposed to read/write variables in the game's address space, I'm interested. I guess this is the problem that prevents me from reading/writing data too, when using a dump of the game that has been made with newer/better dumping tools than Vitamin 1.0. With the Vitamin v1 dump, using addresses taken straight from IDA in plugin code works as expected buth with a Vitamin v2 dump or MaiDumpTool dump it does not.
I guess one easy option would be to patch the eboot itself too (I'd want to use the newest and best version of the game as the base then), but I think it'd be much neater if everything could be kept in a single plugin PRX that would work with any version of the game I happen to have on hand for analysis...
If someone wants to play with it now, I can post the plugin as it is but it's still very rough and like I said only works with a Vitamin 1.0 dump of the game, SHA1 of eboot.bin = 864913971231897C015665FD0DED49B63426D0EA and size = 31,44 MB. I think it's already better than only having next/prev weapon binds, but there are still some problems to work out; there's often a small delay before the game actually switches weapons and I have to add code for disabling the game's own touchscreen inputs in the plugin. see above