Page 1 of 1

nobrokensmbxkicker.lua: Now game over and read credits without launching the broken SMBX launcher! (v1.1.0)

Posted: Sat Apr 30, 2022 11:49 am
by SpencerlyEverly

Since coding these into SMAS++ (Some are scrapped but are actually released now), I did wanna make sure there was a library dedicated to not kicking into the broken SMBX launcher (Found when Saving/Quitting any SMBX 1.3 episode without a custom pause menu).

So today, I now unveil...

nobrokensmbxkicker, a.k.a. A No Broken Launcher Loader Preventer 1.3

This can be replaceable for all episodes. Simply add the files/folders and .lua files on any 1.3 episode and you're good to go! Make sure you aren't replacing any files before copying though. If there are any conflicing credits/gameover folders, let me know asap!

You can load this with pausemenu13.lua to make a fully compatible 1.3 episode experience!

Download it here.

Enjoy!

(Code by me! This time.)


Re: nobrokensmbxkicker.lua: Now game over and read credits without launching the broken SMBX launcher! (v1.0)

Posted: Sat Apr 30, 2022 12:06 pm
by MrDoubleA
There's a big issue with how the game over code works. It uses a variable called playerlives, which is initialised as such:

Code: Select all

local playerlives = mem(0x00B2C5AC,FIELD_FLOAT) --The lives count
... BUT, memory addresses simply don't work like that.
Take the case where the player starts off the level with 0 lives. "playerlives" is thus initialised to 0. Since this is just a usually variable, it will not update at all unless your own code does it. This is because variables store the VALUE assigned to them, and keeps nothing of where it came from.
If you, from here, got a few extra lives, but then died without exiting/restarting the level, you would go straight to the game over sequence.
The easy fix is just to use the actual mem address instead of an extra variable.

Another thing, but one that has no baring on functionality: the game over code is very repetitive. It repeats the same code for both players (which, aside from minor things like no supermario128 support, is just kinda ugly and hard to edit in the future). You can fix this just by using a loop:

Code: Select all

for _,p in ipairs(Player.get()) do
	-- The code here will be run for every single player. 'p' represents the player it is *currently* handling.
	-- 'p' is also the *player itself*, NOT an index. This means you can just do p.x, p.y, p.deathTimer, etc. with no need for Player().
end

Re: nobrokensmbxkicker.lua: Now game over and read credits without launching the broken SMBX launcher! (v1.0)

Posted: Sat Apr 30, 2022 12:16 pm
by SpencerlyEverly
MrDoubleA wrote:
Sat Apr 30, 2022 12:06 pm
There's a big issue with how the game over code works. It uses a variable called playerlives, which is initialised as such:

Code: Select all

local playerlives = mem(0x00B2C5AC,FIELD_FLOAT) --The lives count
... BUT, memory addresses simply don't work like that.
Take the case where the player starts off the level with 0 lives. "playerlives" is thus initialised to 0. Since this is just a usually variable, it will not update at all unless your own code does it. This is because variables store the VALUE assigned to them, and keeps nothing of where it came from.
If you, from here, got a few extra lives, but then died without exiting/restarting the level, you would go straight to the game over sequence.
The easy fix is just to use the actual mem address instead of an extra variable.

Another thing, but one that has no baring on functionality: the game over code is very repetitive. It repeats the same code for both players (which, aside from minor things like no supermario128 support, is just kinda ugly and hard to edit in the future). You can fix this just by using a loop:

Code: Select all

for _,p in ipairs(Player.get()) do
	-- The code here will be run for every single player. 'p' represents the player it is *currently* handling.
	-- 'p' is also the *player itself*, NOT an index. This means you can just do p.x, p.y, p.deathTimer, etc. with no need for Player().
end
Thanks for the suggestions! I'm gonna soon release v1.0.1 that'll implement these fixes. As usual, thanks for the epic reports MDA

Re: nobrokensmbxkicker.lua: Now game over and read credits without launching the broken SMBX launcher! (v1.0.1)

Posted: Sun May 01, 2022 5:06 am
by Woshee_real
Can this work in custom episodes?

Re: nobrokensmbxkicker.lua: Now game over and read credits without launching the broken SMBX launcher! (v1.0.1)

Posted: Mon May 02, 2022 11:10 am
by SpencerlyEverly
Woshee_real wrote:
Sun May 01, 2022 5:06 am
Can this work in custom episodes?
Provided they didn't remove lives, or override anything related to the code that was made, yes. But if anything needs to be overwritten, you can change the code correspondingly to redirect to a different lvlx, and rename folders and files if anything needs to be changed over.

In other words, I can't take any chances of it working fully in X2 episodes.

Re: nobrokensmbxkicker.lua: Now game over and read credits without launching the broken SMBX launcher! (v1.1.0)

Posted: Tue Nov 29, 2022 11:19 pm
by SpencerlyEverly
After so long without an update, v1.1.0 has been released! This gives in some code cleanup and stability, pretty much (No new features this time, unfortunately).

Download it now!

Re: nobrokensmbxkicker.lua: Now game over and read credits without launching the broken SMBX launcher! (v1.1.0)

Posted: Thu Dec 01, 2022 5:41 pm
by Seba the DragonBear
Massive Bejeweled Twist vibes with the "Game Over" voice xd