# The Legend of Zelda: A Link to the Past Decompilation project emerges



## VinsCool (Aug 23, 2022)

Oh heck this is actually awesome!
I wonder what kind of stuff could be made out of it now  
Mainly interested by the maps creation, the music engine, and actors/sprites management


----------



## osaka35 (Aug 23, 2022)

Now this is cool. I stream this game a *lot*, so excited to see what fun will come from this.


----------



## ShadowOne333 (Aug 23, 2022)

VinsCool said:


> Oh heck this is actually awesome!
> I wonder what kind of stuff could be made out of it now
> Mainly interested by the maps creation, the music engine, and actors/sprites management



I'm really interested in the map stuff more than anything.
I am currently making a disassembly to make A Link to the Past Redux open source, and the only problem I had is the map stuff doesn't seem to be keen on working with FastROM. That's where I hit a wall.

All in all, it's nice to see all these great games becoming open source and available in multiple platforms.


----------



## diggeloid (Aug 23, 2022)

Wow that's not a decompilation, it's a reimplementation, like OpenMW is for Morrowind. Also:



> Additionally, it can be configured to also run the original machine code side by side. Then the RAM state is compared after each frame, to verify that the C++ implementation is correct.


That's cool as hell! If it works, this can be verified to basically be a 1:1 recreation of the original.


----------



## Purple_Shyguy (Aug 23, 2022)

You know nitnendo are absolutely seething.m about the source code to all their games being decompiled.


----------



## ShadowOne333 (Aug 23, 2022)

Purple_Shyguy said:


> You know nitnendo are absolutely seething.m about the source code to all their games being decompiled.



Oh I'm sure they're fuming out of their asses.
And the best part about all this is that they can't do jackshit about it, because they gamble losing on court due to precedented cases that Sony and other companies lost already lol


----------



## Obveron (Aug 23, 2022)

Incredible! I can already taste the fan-made dungeons.


----------



## Lostbhoy (Aug 23, 2022)

This is cool!! I'm interested in some sort hd retexture or something to make it look a bit modern.


----------



## m00k00 (Aug 23, 2022)

ShadowOne333 said:


> At the moment, only keyboard is supported for controls


There's already a Pull Request for adding basic Gamepad Support


----------



## Robika (Aug 23, 2022)

Vita version pls!


----------



## JeffRuLz (Aug 23, 2022)

It would be cool to see it running in widescreen on hacked consoles. Bsnes-hd is too demanding for older systems.


----------



## diggeloid (Aug 23, 2022)

Robika said:


> Vita version pls!


This should be really straightforward since it's just using SDL. Although, it would be a pain in the ass to install/distribute legally since it requires a ROM to build. People would need to compile it themselves, which doesn't seem worth the effort because if you have the ROM you can just run that through retroarch lol.

Maybe if it's refactored in a way to load the ROM at runtime it would make sense. That way people can just install the VPK and will have to put their legally obtained ROM onto their memory card. No need to build it manually.


----------



## AshuraZro (Aug 23, 2022)

Neat. I gave this a quick build and quickly did the out of bounds to the Triforce room for a quick laugh.


----------



## TraderPatTX (Aug 23, 2022)

ALTTP is easily one of my favorite Zelda games. I'm pretty sure I got it for Christmas back in '92. Looking forward to see what comes of this project.


----------



## ShadowOne333 (Aug 23, 2022)

diggeloid said:


> This should be really straightforward since it's just using SDL. Although, it would be a pain in the ass to install/distribute legally since it requires a ROM to build. People would need to compile it themselves, which doesn't seem worth the effort because if you have the ROM you can just run that through retroarch lol.
> 
> Maybe if it's refactored in a way to load the ROM at runtime it would make sense. That way people can just install the VPK and will have to put their legally obtained ROM onto their memory card. No need to build it manually.



Should be easy enough to make a tool that can compile the code and all the user has to do is put in their own ROM.
That's how the other decomp projects do it for installers and such, Ship of Harkinian handles it this way.


----------



## The_Fire_Shark (Aug 23, 2022)

Awesome, can't wait to see native ports on other platforms and easier mod support.


----------



## SuperDan (Aug 23, 2022)

Super Widescreen Bsnes Please


----------



## Lazyt (Aug 23, 2022)

never played this game so maybe its already time?


----------



## linuxares (Aug 23, 2022)

So many decompilation. I wonder how many of them are just Ghidra dumps...


----------



## Manurocker95 (Aug 23, 2022)

The instructions are not as clear as they should be (SDL library is missing) but got it running. The x86 suffers tons of sound stuttering for some reason.


----------



## diggeloid (Aug 23, 2022)

ShadowOne333 said:


> Should be easy enough to make a tool that can compile the code and all the user has to do is put in their own ROM.
> That's how the other decomp projects do it for installers and such, Ship of Harkinian handles it this way.


Well, for what it's worth, I just tried to build it for Vita, and it built very easily... unfortunately, it runs at like 7 FPS even when overclocked. If someone has the time, it might be possible to get this running well.


----------



## sombrerosonic (Aug 23, 2022)

linuxares said:


> So many decompilation. I wonder how many of them are just Ghidra dumps...


Probably a ton of them when they learn how to use it


----------



## linuxares (Aug 23, 2022)

sombrerosonic said:


> Probably a ton of them when they learn how to use it


That's the thing, then they're illegal. You have to clean room code it.


----------



## lordelan (Aug 24, 2022)

ShadowOne333 said:


> I'm really interested in the map stuff more than anything.
> I am currently making a disassembly to make A Link to the Past Redux open source, and the only problem I had is the map stuff doesn't seem to be keen on working with FastROM. That's where I hit a wall.
> 
> All in all, it's nice to see all these great games becoming open source and available in multiple platforms.


Also this should allow playing it in any resolution and aspect ratio. Theoretically.
Really cool news.

I wonder at which point in time we will have AI decompilations of literally anything we want.
I mean, a good enough AI with enough horse power should be able to decompile even the newest AAA games shortly after release. Wonder where that'll take us. No more closed source games would be possible, except their code just makes calls to some cloud sh*t they have running and the game sits just there instead of our local machines.


----------



## lincruste (Aug 24, 2022)

Lostbhoy said:


> This is cool!! I'm interested in some sort hd retexture or something to make it look a bit modern.


That would be a


----------



## mituzora (Aug 24, 2022)

I love these projects!  it reminds me of when I'd go find source mods like eduke32 and Quake2XP.  can't wait to see what people come up with this.  compile it for PC with the CD quality audio mod done for flash carts, widescreen support, and the ability to load your own maps.  that'd be dope as hell


----------



## scoobydude51 (Aug 24, 2022)

Obveron said:


> Incredible! I can already taste the fan-made dungeons.


and it being ported to everything


----------



## CMDreamer (Aug 24, 2022)

Love decompilation projects!


----------



## DarthMotzkus (Aug 24, 2022)

Lostbhoy said:


> This is cool!! I'm interested in some sort hd retexture or something to make it look a bit modern.


YES! PLEASE!


----------



## Nerdtendo (Aug 24, 2022)

Manurocker95 said:


> The instructions are not as clear as they should be (SDL library is missing) but got it running. The x86 suffers tons of sound stuttering for some reason.


I was wondering what was going on with my build. I guess I'm rebuilding for x64!


----------



## MikaDubbz (Aug 24, 2022)

Gotta love decomps.  Though I am less excited for those that are games from much older hardware.  If my Wii U can already play the game fantastically, then new options for a build better excite.  Like Mario 64 getting a free moving camera and native widescreen (or going all out with ridiculous improvements like Render96).  But what is ALTTP gonna offer than the original didn't?  I mean maybe it too could get native widescreen?  That might be cool (though considering the nature of classic 2D Zelda games, this probably wouldn't even look particularly great throughout the game), but I'm not sure what more could be done to the core experience. 

Meanwhile, I find Sonic Mania to be fascinating, its a modern game, but it's not a taxing game, it easily can run on the likes of the Wii U or Vita, but fans had to make it happen through decompilations.  Which I think is really cool.  There are plenty of modern indie games that don't require a powerhouse to play, and for that reason, I'm curious if more games of the like might one day join.  A game like Stardew Valley or Golf Story feel like perfect fits for modern decompilations.


----------



## SoThatOneGuy (Aug 24, 2022)

Very kool


----------



## Rgorgory (Aug 24, 2022)

I know 0 about how this works, but it would be great to have the game free to walk through the field without the screens swiping up,down,left,right at border of each section
also i guess widescreen support is coming soon, and hopefully some textures and hd sound


----------



## Dragon91Nippon (Aug 24, 2022)

ShadowOne333 said:


> Oh I'm sure they're fuming out of their asses.
> And the best part about all this is that they can't do jackshit about it, because they gamble losing on court due to precedented cases that Sony and other companies lost already lol


Also even if they did win they aren't going to be able to put the genie back in the bottle anyway, someone (who isn't a Nintendo Ass kisser) will eventually illegally re-upload it.


----------



## mituzora (Aug 24, 2022)

Rgorgory said:


> I know 0 about how this works, but it would be great to have the game free to walk through the field without the screens swiping up,down,left,right at border of each section
> also i guess widescreen support is coming soon, and hopefully some textures and hd sound


HD sound is almost a given.  you should take a look at the LTTP port for SNES that uses the coprocessor found on everdrives to produce CD quality audio.  I can't remember the custom chip name, but it's really cool


----------



## Dragon91Nippon (Aug 24, 2022)

MikaDubbz said:


> Gotta love decomps.  Though I am less excited for those that are games from much older hardware.  If my Wii U can already play the game fantastically, then new options for a build better excite.  Like Mario 64 getting a free moving camera and native widescreen (or going all out with ridiculous improvements like Render96).  But what is ALTTP gonna offer than the original didn't?  I mean maybe it too could get native widescreen?  That might be cool (though considering the nature of classic 2D Zelda games, this probably wouldn't even look particularly great throughout the game), but I'm not sure what more could be done to the core experience.
> 
> Meanwhile, I find Sonic Mania to be fascinating, its a modern game, but it's not a taxing game, it easily can run on the likes of the Wii U or Vita, but fans had to make it happen through decompilations.  Which I think is really cool.  There are plenty of modern indie games that don't require a powerhouse to play, and for that reason, I'm curious if more games of the like might one day join.  A game like Stardew Valley or Golf Story feel like perfect fits for modern decompilations.


The Games I'm looking forward to being decompiled are Twilight Princess and Windwaker since that would mean the Fabled Switch ports would be possible in Homebrew, Also SMG2 would be a good one, I have a Feeling Nintendo won't ever port those officially so Decomp is the only way.


----------



## niuus (Aug 24, 2022)

inb4 people asks for wii, wii u, 3ds, vita, psp, dreamcast, and ps2 ports.

Decomps are really cool.


----------



## Kwyjor (Aug 24, 2022)

linuxares said:


> That's the thing, then they're illegal. You have to clean room code it.


This has all been hashed out in the courts repeatedly. You don't have to "clean room" code something in order for it to be suitably legal.



mituzora said:


> HD sound is almost a given.  you should take a look at the LTTP port for SNES that uses the coprocessor found on everdrives to produce CD quality audio.  I can't remember the custom chip name, but it's really cool


Are you thinking of the MSU-1? Pretty much all it really does is read audio or video from an external file. (But then, perhaps that's all it really needs to do.)


----------



## mituzora (Aug 24, 2022)

Kwyjor said:


> This has all been hashed out in the courts repeatedly. You don't have to "clean room" code something in order for it to be suitably legal.
> 
> Are you thinking of the MSU-1? Pretty much all it really does is read audio or video from an external file. (But then, perhaps that's all it really needs to do.)


Yup, that's the one. thanks! 

looking it up, it allows the cartridge to use up to 4 GB for the ROM, so you can put in things like FMV cutscenes, but it also handles the CD-quality audio streams to free up the the other native SNES channels for sound effects, so it's a pretty capable chip all things considered.


----------



## Cris1997XX (Aug 24, 2022)

Hell yeah!! Can't wait for people to make a DS port


----------



## Dungeonseeker (Aug 24, 2022)

Kwyjor said:


> This has all been hashed out in the courts repeatedly. You don't have to "clean room" code something in order for it to be suitably legal.


Has it? Can you show a source for this?


----------



## Cris1997XX (Aug 24, 2022)

Dungeonseeker said:


> Has it? Can you show a source for this?


The source is that I made it the fuck up


----------



## Dungeonseeker (Aug 24, 2022)

Cris1997XX said:


> The source is that I made it the fuck up


AFAIK....

Despite what most believe to be true, IBM actually never sued Pheonix or Compaq over the AT BIOS being decompiled leading to IBM clones.

The most cited case is Intel Vs NEC which is interesting. Intel sued NEC over an alleged 8086 microcode copyright, NEC went on to win but not by using the CR defence, instead they hired an indy dev to write the same code and used this as proof to the judge that the only way to do these functions was the way they had done it by showing similarities between the 2 entirely separate projects. They couldn't use clean room since they were actually licensed by Intel to use the code at the time.

The last case thats often cited is Sony Vs Connectix. Sony tried to sue them for decompiling the PS BIOS, at first they won a preliminary judgement but this was later overturned and when it became obvious they were gonna lose they did what all corps do and threw money at it. Sony ended up just buying Connectix out and no judgement was ever made.

Lets not forget that only last year Take Two shut down all those GTA decomp projects. The problem is nobody wants to be the first to take on a multi billion $ business in court to test it properly.


----------



## Pleng (Aug 24, 2022)

Lostbhoy said:


> This is cool!! I'm interested in some sort hd retexture or something to make it look a bit modern.



I wonder if assets from A Link Between Worlds could be used? It shares the same 2 overworld maps. Dungeons may be an issue.


----------



## Ajlr (Aug 24, 2022)

Wonder what SNES game is next.


----------



## Lostbhoy (Aug 24, 2022)

Pleng said:


> I wonder if assets from A Link Between Worlds could be used? It shares the same 2 overworld maps. Dungeons may be an issue.


Id think they could be used, not in 3ds format obviously but converting the textures should be a doddle.


----------



## HalfScoper (Aug 24, 2022)

yawn, when to do the good games get decompiled.


----------



## Bladexdsl (Aug 24, 2022)

*countdown to DMCA!*


----------



## godreborn (Aug 24, 2022)

after a bit of trial and error, I got it:


----------



## ldeveraux (Aug 24, 2022)

HalfScoper said:


> yawn, when to do the good games get decompiled.


gosh you're stupid


----------



## godreborn (Aug 24, 2022)

ldeveraux said:


> gosh you're stupid


he's probably trolling.  he was already on my ignore list for something.


----------



## PacBunny (Aug 24, 2022)

Ok whats goin on? Sonic Mania and now this!?!?!?!?!? ...This is gonna be sweet.


----------



## JaapDaniels (Aug 24, 2022)

Sounds cool, but to accomplish what?
To what i know we already had modding for this game for everything except 16kHD and dolby 9.2 support.
Sure wanna try it though!
lemme know when there's a builder GUI for it.


----------



## godreborn (Aug 24, 2022)

JaapDaniels said:


> Sounds cool, but to accomplish what?
> To what i know we already had modding for this game for everything except 16kHD and dolby 9.2 support.
> Sure wanna try it though!
> lemme know when there's a builder GUI for it.


I don't know if there could be a gui, because you do need sdl2.dll in the system32 or sysWOW64 folders depending on which version you're using.  they used 2.20 iirc.  the other stuff could be done, but that is a requirement.


----------



## Kwyjor (Aug 24, 2022)

I should add that while Hyrule Magic (the existing ALTTP editor) might leave much to be desired, I have the impression that the sheer complexity of designing good levels seems to have been more of a barrier to new projects.



Dungeonseeker said:


> Has it? Can you show a source for this?


I was reading a really nice summary a while ago, but can't seem to find it at the moment. https://www.internetandtechnologylaw.com/history-fair-use-defense-software/ is pretty close.

ETA: Maybe I'm thinking of https://scholarship.law.ufl.edu/cgi/viewcontent.cgi?article=1099&context=jtlp ?


----------



## godreborn (Aug 24, 2022)

btw, by version, I actually mean x86 or x64.  should be obvious which is which.  lol, but they do use an older version of sdl, though not much older than the latest.


----------



## ShadowOne333 (Aug 24, 2022)

I'm sure the project itself could benefit a lot from a performance boost if it shifts libraries to OpenGL instead of SDL2.
That'll help it run in a wide variety of devices with decent performance I'm guessing.


----------



## Guacaholey (Aug 24, 2022)

So... blonde haired Link?


----------



## ShadowOne333 (Aug 24, 2022)

Guacaholey said:


> So... blonde haired Link?



Already a thing, mate 
https://www.romhacking.net/hacks/2594/


----------



## QuenchGrust (Aug 24, 2022)

Would be nice to get multiple item slots lke OoT, since two buttons go unused even on a SNES pad.


----------



## Kwyjor (Aug 25, 2022)

ShadowOne333 said:


> I'm sure the project itself could benefit a lot from a performance boost if it shifts libraries to OpenGL instead of SDL2.
> That'll help it run in a wide variety of devices with decent performance I'm guessing.


The whole point to SDL is that it allows something to be run on a wide variety of devices, isn't it?


----------



## godreborn (Aug 25, 2022)

Kwyjor said:


> The whole point to SDL is that it allows something to be run on a wide variety of devices, isn't it?


iirc, oot runs on sdl2.  I could've sworn it was a requirement for most if not all builds of the game on all platforms.


----------



## JaapDaniels (Aug 25, 2022)

godreborn said:


> I don't know if there could be a gui, because you do need sdl2.dll in the system32 or sysWOW64 folders depending on which version you're using.  they used 2.20 iirc.  the other stuff could be done, but that is a requirement.


Detect if sdl2.dll is in %windir%\SysWOW64\
If folder not found:
%windir%\System32\
If not:
Download sdl2.dll
Move sdl2.dll to %windir%\SysWOW64
regsvr32 %windir%\SysWOW64\sdl2.dll
If failed:
Move sdl2.dll to %windir%\System32
regsvr32 %windir%\System32\sdl2.dll
I mean a GUI like sm64pcbuilder2.
If there's anything illegal by such a script, tell me.
%windir% can also be replaced with %systemroot% it seems (no idea wich one is better to use)


----------



## godreborn (Aug 25, 2022)

JaapDaniels said:


> Detect if sdl2.dll is in %windir%\SysWOW64\
> If folder not found:
> %windir%\System32\
> If not:
> ...


no, it's not hard to compile if you have vs 2022.  you need the vc version to get the libraries to build, then, at least with mine, the SDL2.dll for (x86), which goes in the system32 folder.


----------



## JaapDaniels (Aug 25, 2022)

godreborn said:


> no, it's not hard to compile if you have vs 2022.  you need the vc version to get the libraries to build, then, at least with mine, the SDL2.dll for (x86), which goes in the system32 folder.


Got it working, now how to get it fullscreen in windows?


----------



## godreborn (Aug 25, 2022)

JaapDaniels said:


> libsdl2-dev
> 
> Got it working, now how to get it fullscreen in windows?


I just checked if it worked.  I don't know.


----------



## JaapDaniels (Aug 25, 2022)

godreborn said:


> I just checked if it worked.  I don't know.


Got it fullscreen with a small mod to main.cpp line 55:
SDL_Window* window = SDL_CreateWindow("Zelda3", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 1920, 1080, SDL_WINDOW_FULLSCREEN_DESKTOP);
The resoluttion is disregarded though.
You can remover _DESKTOP and the resolution doesn't seem to improve by altering it, the end result is the same...
Is there anyone  able to make a better mod?

With possible switching between fullscreen and windowed mode).
Smooth scaling or better resolution.
Thanks in advance.
Made a fork for it see: githublink
It should now have controller support and work in fullscreen.


----------



## Viorlu (Aug 26, 2022)

That’s awesome!


----------



## Viri (Aug 27, 2022)

Can't wait for someone to port it to Sega Genesis or Sega CD!


----------



## godreborn (Aug 27, 2022)

JaapDaniels said:


> Got it fullscreen with a small mod to main.cpp line 55:
> SDL_Window* window = SDL_CreateWindow("Zelda3", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 1920, 1080, SDL_WINDOW_FULLSCREEN_DESKTOP);
> The resoluttion is disregarded though.
> You can remover _DESKTOP and the resolution doesn't seem to improve by altering it, the end result is the same...
> ...


just tested your mod:


----------



## JaapDaniels (Aug 27, 2022)

godreborn said:


> just tested your mod:
> 
> View attachment 324619


Thanks!
My first github project, and it worked! (kinda)
Really hope someone can get a beter scale/interpolation funcion and the option to switch between fullscreen and windowed mode.
But this works for now.
main.cpp is where SDL2 gets started it seems, here is difined how to display, how sound is defined and where your controller input is written.
Ohh and a big failure is savegames... restarting the game will be a clean startup each time...
Savestate and savegame function didn't seem to work for me, is there anyone here who know how the snes emulator saves and load SRM (SRAM savegames)? that would be a cool thing to add.
Each time you start the game now it starts with a clean SRAM, while on the snes the SRAM is kept life by a battery.
i am really new to this so i really don't know what i'm doing right now, but could this initation of ram be set to overwrite itself while ingame, or when exiting? that should make the original way of savegame working.
and can someone please help me with switch option in window mode:

Fullscreen:  SDL_Window* window = SDL_CreateWindow("Zelda3", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 512, 480, SDL_WINDOW_FULLSCREEN_DESKTOP);
Windowed:  SDL_Window* window = SDL_CreateWindow("Zelda3", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 512, 480, SDL_WINDOW_RESIZABLE);
Both lines work for me in main.cpp, but it would be great to be able to switch between modes with ALT+ENTER in-game.


----------



## LuigiXHero (Aug 28, 2022)

Not a decomp dunno why gbatemp is constantly wrong about stuff like this and doesn't fix it when people point it out. This is a reimplentation. The original game was not programmed in c++. Basically means the creator took the disassembly and rewrote the code in c++. Also should probably mention its for pc. Decomp doesn't mean pc port either.


----------



## godreborn (Aug 28, 2022)

LuigiXHero said:


> Not a decomp dunno why gbatemp is constantly wrong about stuff like this and doesn't fix it when people point it out. This is a reimplentation. The original game was not programmed in c++. Basically means the creator took the disassembly and rewrote the code in c++. Also should probably mention its for pc. Decomp doesn't mean pc port either.


maybe they didn't know?  the article is by a developer, who may not be able to change the title name.  I know that normal users can't, but that is a suggestion I would have for temp, the ability to change say a thread name or even an article, so that staff don't have to do it when mistakes are made.  I know you can do this on psx-place under mod tools with only threads you've created.


----------



## ShadowOne333 (Aug 29, 2022)

LuigiXHero said:


> Not a decomp dunno why gbatemp is constantly wrong about stuff like this and doesn't fix it when people point it out. This is a reimplentation. The original game was not programmed in c++. Basically means the creator took the disassembly and rewrote the code in c++. Also should probably mention its for pc. Decomp doesn't mean pc port either.





godreborn said:


> maybe they didn't know?  the article is by a developer, who may not be able to change the title name.  I know that normal users can't, but that is a suggestion I would have for temp, the ability to change say a thread name or even an article, so that staff don't have to do it when mistakes are made.  I know you can do this on psx-place under mod tools with only threads you've created.



godreborn is right, I wrongly used the word "decomp" because that's what most people nowadays think alongside PC ports (which btw ALttP works on PC now with this implementation).
By the time I wanted to change the title, I couldn't anymore, since GBATemp doesn't allow the OPs to change the title of the thread once it has been created.

So if any mods see this, perhaps @linuxares, if you could change the title from "decompilation" to "C/C++ language implementation" it'd be ideal, since it's the proper term here.


----------



## godreborn (Aug 29, 2022)

ShadowOne333 said:


> godreborn is right, I wrongly used the word "decomp" because that's what most people nowadays think alongside PC ports (which btw ALttP works on PC now with this implementation).
> 
> By the time I wanted to change the title, I couldn't anymore, since GBATemp doesn't allow the OPs to change the title of the thread once it has been created.


it's a bit like saying cfw or jailbreak with the ps4 when neither term is accurate.  I usually use the word exploit.


----------



## ShadowOne333 (Aug 29, 2022)

godreborn said:


> it's a bit like saying cfw or jailbreak with the ps4 when neither term is accurate.  I usually use the word exploit.


Correct. In short, I went for "decomp" due to the familiarity of the word in recent events, but obviously "reimplementation" is the proper term.
Still, having the titled change by a mod should be neat


----------



## godreborn (Aug 29, 2022)

ShadowOne333 said:


> Correct. In short, I went for "decomp" due to the familiarity of the word in recent events, but obviously "reimplementation" is the proper term.
> Still, having the titled change by a mod should be neat


btw, what's odd about this build is that the location it searchs for the library files seems to be hard coded or something, because I changed the library location for dependencies, erased all the rest, as well as for include, but it didn't make any difference.  it still looked in D/lib iirc.  I don't know why, but I had to change the drive letter of one of my drives to make it work, then I changed it back.  it happened both times I compiled it with the second being the full screen mod.  no idea what was going on, because I didn't have this problem with sonic mania, and that requires three libraries instead of this one's one.


----------



## LuigiXHero (Aug 29, 2022)

Oh had no clue you couldn't fix it. Apologies then.


----------



## JaapDaniels (Aug 29, 2022)

@godreborn I've made an update to my fork trying to implement a toggle for fullscreen and windowed mode bij creating and reading an .ini file.
I used mINI lib for this, could you get anyone who understands this better to look at what i'm doing wrong?
Pressing PageDown should set fullscreen value in the .ini to 0 (so when restarting the game it should detect this as it should start in windowed mode).
Pressing PageUp should set fullscreen value in the .ini to 1 (so when restarting the game it should detect this as it should start in fullscreen mode)


----------



## DaniPoo (Sep 1, 2022)

linuxares said:


> So many decompilation. I wonder how many of them are just Ghidra dumps...



Or it could just be that one decompilation project inspires another.

I am very much for these decompilation projects as it's very unlikely that nintendo will do this kind of work themselves.

For instance it allows us to create proper remasters of old classics.
60fps, widescreen, new models and HD textures with raytracing on a game like SM64 for example.

I find that extremely cool.

Of course I hope that everything is done in a legal fashion.


----------



## ldeveraux (Sep 1, 2022)

godreborn said:


> he's probably trolling. he was already on my ignore list for something.


And you're on mine


----------



## ShadowOne333 (Sep 1, 2022)

FYI the graphics in 2D games (at least old school ones from older platforms) are NOT textures.
It irks me whenever someone says "textures" when referring to graphics of something from the SNES or NES.

They're sprites damnit 
Textures are graphics you apply unto 3D objects or meshes to give the illusion of the object having an actual "texture" in real life.
Sprites are pixel graphics developed to work on 2D environments, flat out 2D images that behave as objects by themselves, not attached to anything 3D.

...or at least that's how I see it, feel free to argument on the matter, I'm all ears.


----------



## JaapDaniels (Sep 1, 2022)

Fixed it test my latest fork @ GitHub now with windowed mode (resizable) and fullscreen mode. Just the trigger of pageup and down is set for next start of the game (not reset, but fully closing the game and restarting it).


----------



## godreborn (Sep 1, 2022)

JaapDaniels said:


> Fixed it test my latest fork @ GitHub now with windowed mode (resizable) and fullscreen mode. Just the trigger of pageup and down is set for next start of the game (not reset, but fully closing the game and restarting it).


I'm confused.  your fork is missing files, so I don't know what to ditch and what to keep from the original master version.


----------



## godreborn (Sep 1, 2022)

nm, I figured it out.  however, it errors saying it can't find ini.h.


----------



## urherenow (Sep 2, 2022)

DaniPoo said:


> new models and HD textures with raytracing on a game like SM64 for example.


INB4 new release with nude Princess Zelda HD...


----------



## godreborn (Sep 2, 2022)

JaapDaniels said:


> Fixed it test my latest fork @ GitHub now with windowed mode (resizable) and fullscreen mode. Just the trigger of pageup and down is set for next start of the game (not reset, but fully closing the game and restarting it).


I wasn't able to compile your build due to it not finding ini.h for some reason.  it's in the include folder, so something may be wrong with the cmake file.  I was going to test out your mod, but I'll need information on what the problem is.  btw, I compiled the new, official build, and it looks like they use nugets now instead of requiring you to download the sdl vc stuff yourself, so it's even easier to compile.


----------



## urherenow (Sep 2, 2022)

So for the devs among you, I found a bug that *should* be an easy fix. If you hard-reset (press "E"), the machine does not check for the cartridge save. It's annoying. You currently have to close the program and re-open it, to see the save in the game... Opened an issue in github.


----------



## Subway_Sandwich (Sep 2, 2022)

Very excited, can't wait! I've always been trying to find a way to play Link to the Past, but I've personally been a bit unsuccessful. So, this should be useful. (Before replying please note that I do not have a lot of cash, and cannot afford a console for the game, nor the game itself. Not until my next payment at least.)


----------



## Kwyjor (Sep 2, 2022)

Subway_Sandwich said:


> I've always been trying to find a way to play Link to the Past, but I've personally been a bit unsuccessful.


I was just reading about a new version of the "Redux" patch.
https://www.romhacking.net/hacks/2594/


----------



## urherenow (Sep 3, 2022)

I was right. The save issue on hard reset was a 1-liner fix. Just had to re-read the sram on hard reset. That was already fixed, and it looks like another commit added gamepad support, since I first cloned and built it.


----------



## VinsCool (Sep 3, 2022)

ShadowOne333 said:


> FYI the graphics in 2D games (at least old school ones from older platforms) are NOT textures.
> It irks me whenever someone says "textures" when referring to graphics of something from the SNES or NES.
> 
> They're sprites damnit
> ...


I could have sworn they were called "tiles", "characters" or typically "objects" 

To be *fair* however, the way some of the graphics are used are indeed what a "texture" is by definition, so I wouldn't blame anyone (including myself) to use either word interchangeably, at the end, we understand what it is referring to, and that's what really matters.


----------



## JaapDaniels (Sep 3, 2022)

godreborn said:


> nm, I figured it out.  however, it errors saying it can't find ini.h.


ini.h is in include\ini.h or you can add it from mINI's repo (adress is in the readme.md).
Aha, Cmake isn't updated at for i didn't use in is VS 2022, wiil add the lines for including SDL2 and mINI
Holy fuck it's changed from C++ version to C.
They rewrote about all i understood.
So, my version is not compitable with the original anymore, and i'm not sure i want to go that road.
I don't like it when you just go replace a project with a complete new one, it's confusing.
Since i just only tested the windows way to built with VS 2022 community, i don't know if cmake will make problems.
Should be included now if i understand cmake.


----------



## JaapDaniels (Sep 3, 2022)

urherenow said:


> I was right. The save issue on hard reset was a 1-liner fix. Just had to re-read the sram on hard reset. That was already fixed, and it looks like another commit added gamepad support, since I first cloned and built it.


Wait, tell me details, cause that's the next thing i wanna learn (since it's my first ever try at a c like language you'll notice it'll take time to catch up, but saving sram and reading sram again was the very next thing to fix, in the built i've seen it starts with cleaned ram and never checks if there's an update...
My built works with gamepad, and added windowed and fullscreen mode at full close and start (it reads it from an ini file).


----------



## urherenow (Sep 3, 2022)

JaapDaniels said:


> Wait, tell me details, cause that's the next thing i wanna learn (since it's my first ever try at a c like language you'll notice it'll take time to catch up, but saving sram and reading sram again was the very next thing to fix, in the built i've seen it starts with cleaned ram and never checks if there's an update...
> My built works with gamepad, and added windowed and fullscreen mode at full close and start (it reads it from an ini file).


Details? It’s literally 1 line, but that’s when it was working from a freshly opened instance. The function to check the sram was already in there, but not executed when using the hard reset. Plain as that. Just look at the commit history on github to see it. If your build doesn’t check sram at all, it’s going to take more than 1 line to add it in.


----------



## JaapDaniels (Sep 3, 2022)

urherenow said:


> Details? It’s literally 1 line, but that’s when it was working from a freshly opened instance. The function to check the sram was already in there, but not executed when using the hard reset. Plain as that. Just look at the commit history on github to see it.


Well when i made a fork it was all c++, they wiped it and started from scratch in C now, almost effery line is changed so, that's a hard reset for me.
And to be honest, i'm not interested in learning the complete set of programm languages, i'm interested to get to understand C++, soi already set my goal for a deep dive and a sharp learning curve going from turbo pascal (which i didn't practise for more than 20 years) over to C++.
But i'll try to find it, though i already seen they completely rewrote cart.cpp with cart.c...
I see what you mean, litterly one line in the C code, but, since i'm on the C++ flow, (see my fork) i'm not so sure that this one line will actually work for me.
I want the Sram to be saved on exit somehow... on reset it's working, but not on exit and restarting the game.


----------



## urherenow (Sep 3, 2022)

JaapDaniels said:


> Well when i made a fork it was all c++, they wiped it and started from scratch in C now, almost effery line is changed so, that's a hard reset for me.
> And to be honest, i'm not interested in learning the complete set of programm languages, i'm interested to get to understand C++, soi already set my goal for a deep dive and a sharp learning curve going from turbo pascal (which i didn't practise for more than 20 years) over to C++.
> But i'll try to find it, though i already seen they completely rewrote cart.cpp with cart.c...
> I see what you mean, litterly one line in the C code, but, since i'm on the C++ flow, (see my fork) i'm not so sure that this one line will actually work for me.
> I want the Sram to be saved on exit somehow... on reset it's working, but not on exit and restarting the game.


All you had to do was search for the function. Does your code call the function in main.c around line 191? If so, then yes, it will take care of the issue. If not, the search shows which file currently has the function, so you can try to write it yourself.

EDIT: Yea, just looked at your fork. Big difference. Same concept, however. Figure out how the sram is initialized when you start the program, and make sure you’re calling that function on reset as well.


----------



## JaapDaniels (Sep 3, 2022)

urherenow said:


> All you had to do was search for the function. Does your code call the function in main.c around line 191? If so, then yes, it will take care of the issue. If not, the search shows which file currently has the function, so you can try to write it yourself.
> 
> EDIT: Yea, just looked at your fork. Big difference. Same concept, however. Figure out how the sram is initialized when you start the program, and make sure you’re calling that function on reset as well.


main.cpp line 16 and 172 are talking about ram just not the same ram.
I think 172 is tha ram i should go for.
It goes to snes/cart.cpp and cart.h.
I see there's something called cart_saveload wich talks about the cart ram...
I think that's what i need to call to save and load the sram.
Reset save works in my fork, but really closing the game it does not work when starting the game again.
The save function that should be on shif+F# and load of F# somehow looks to do nothing (i think this was meant to be realtime-savestate).
So time to go puzzle later, tommorow i'll check.
After that an extra tool to configure keyboard and joypad, for you should be able to configure what button does what.
(i think i can use the config.ini for saving these settings).


----------



## godreborn (Sep 14, 2022)

JaapDaniels said:


> ini.h is in include\ini.h or you can add it from mINI's repo (adress is in the readme.md).
> Aha, Cmake isn't updated at for i didn't use in is VS 2022, wiil add the lines for including SDL2 and mINI
> Holy fuck it's changed from C++ version to C.
> They rewrote about all i understood.
> ...


I was never able to get your new version to work.  Cmake files appear to be missing.  I don't have a problem with the main branch.  I compiled a newer version, which no longer requires you to download sdl2 vc iirc.


----------



## AsPika2219 (Sep 14, 2022)

Nostalgia! Zelda 3 a link to the past since SNES games!  I will play it again with nice hacking "A LINK TO THE PAST REDUX"!


----------



## JaapDaniels (Sep 14, 2022)

godreborn said:


> I was never able to get your new version to work.  Cmake files appear to be missing.  I don't have a problem with the main branch.  I compiled a newer version, which no longer requires you to download sdl2 vc iirc.


Cmake was not updated as i said, and since ms visual studio doesn't use it i don't know how to test cmake. last check i altered cmake to what i think is what it should look like. 
Cmake needs the folder /include/ and it's subfolders added.
This is also including SDL2, joypad compitable, and saved settings for fullscreen/windowed mode.
The main version has completely been replaced by C99 structure, and i'm not interested in going that road....
i still don't like main.cpp for it's messy at best, so i might try to replace it in time...
in include is mINI and SDL2, in the sub maps SDL2 libs are for x86 and x64 wich should be all needed to add.
mINI for saving configuration so you can run the game both fullscreen and windowed, SDL2 for it should've been in the build for graphics, for audio, for input...
Still, i didn't get in game changing windowmode, you'll have to restart the game to get fullscreen/windowed mode changed.
Savegames still got lost (i really don't understand how the cartram is handled yet.


----------



## impeeza (Oct 10, 2022)

A few days ago (October 6th) Switch version was added, I just compile using MSYS and works like a charm.  You need to copy  the files zelda3.nro, zelda3.ini and zelda3_assets.dat on the folder of homebrew on switch.

The "zelda3_assets.dat" can be generated on the same MSYS installation without need of external python, and only need the original "Legend of Zelda, The - A Link to the Past (1992)(Nintendo)(US).sfc" (66871d66be19ad2c34c927d6b14cd8eb6fc3181965b6e517cb361f7316009cfb SHA256) ROM to extract the copyrighted material from it.


----------



## fdyyt (Oct 10, 2022)

ShadowOne333 said:


> ​Out of the blue, and without any kind of mention, a mostly complete decompilation project coded in C/C++ from the SNES classic, The Legend of Zelda: A Link to the Past, has emerged on GitHub under the MIT license.
> 
> The project was released around 9 days ago, on August 14th, and seems to be playable from start to end.
> Right now the decompilation is compatible with Windows (compilable with Visual Studio) and Linux (using SDL2 and Python).
> ...


Interesting, but it is only going to really benefit a niche group.


----------



## godreborn (Oct 10, 2022)

here's the windows version (you'll have to make your own assets file as I didn't include it for obvious reasons):


----------



## Buda (Oct 19, 2022)

godreborn said:


> here's the windows version (you'll have to make your own assets file as I didn't include it for obvious reasons):


Clicking on .exe does nothing.
How do I make assets file?


----------



## godreborn (Oct 19, 2022)

Buda said:


> Clicking on .exe does nothing.
> How do I make assets file?


Iirc, you have to put the rom in tables folder of the repo, then use the python scripts of extract and compile.  You do need a couple of pip dependencies, but you can easily install all of them with the requirements.txt file.


----------



## impeeza (Oct 23, 2022)

Buda said:


> Clicking on .exe does nothing.
> How do I make assets file?



Instructions of use / build:
https://github.com/snesrev/zelda3

Detailed build instructions:
https://github.com/snesrev/zelda3/wiki

Support:
https://discord.gg/AJJbJAzNNJ

You need a legally obtained US ROM file, renamed zelda3.sfc.  Must to have the SHA256 hash 66871d66be19ad2c34c927d6b14cd8eb6fc3181965b6e517cb361f7316009cfb.  The file is only needed to extract the Assets which are copyrighted by big N and can't be shared nor included on a compiled product.

For compiling you can use on windows, TinyCC + Python, Visual Studio + Python or MSYS
On Mac/Linux, you need python and a CC compiler

On all versions you need Python only for extract assets.  Install python as you preffer and then install the modules Pillow & PyYAML, if you don't want to compile by yourself, you need the original ROM and a python environment to create the zelda3_assets.dat.


----------



## godreborn (Oct 23, 2022)

here's a build for linux.  it will make the assets file for you during make, so it's technically the easiest one to build.


----------



## impeeza (Oct 23, 2022)

godreborn said:


> here's a build for linux.  it will make the assets file for you during make, so it's technically the easiest one to build.


Also on Windows, if you use MSYS the command make  will run assets commands on a step.


----------



## linuxares (Oct 23, 2022)

Yeah the compiler more or less runs the scripts to build the asset file for you if it finds the rom file


----------



## godreborn (Oct 23, 2022)

Maybe they're really all like that, and I forgot?


----------



## impeeza (Oct 23, 2022)

If is useful for anybody:
Commit version 8bee717 (2022/10/22 10:00 UTC), for Windows 64bits
Also for Switch NRO, plus Switch Forwarder with custom startup icons.

As always you need to provide your zelda3_assets.dat file


----------



## godreborn (Oct 23, 2022)

off topic, but I think I figured out why my ps2 build of super mario 64 works only in a ps2 emulator and not on the machine.  it has to do with the ps2sdk specifically.  I'm going to use the one from 10/15/2020, which is what the one on the internet was built using.  I have it on my computer, but right now I'm compiling the ps2 full toolchain.  I hope this works, but the older sdk version requires some files that are only available on mac or windows (there's no linux version), so I was unable to compile it correctly on linux.  I think they also used msys by the looks of it.  it's pretty slow going on my slow computer.  sometimes it takes a very long time for something to compile, but it's usually not that long unless it's an sdk or a toolchain like this is.


----------



## impeeza (Oct 23, 2022)

yes MSYS trend to be slow because for default run on low priority process, put -j as parameter of Make command, for me speedup the compiling time 4x times


----------



## godreborn (Oct 23, 2022)

it's not a make command.  it's a shell script, not sure if j4 works with it or not, but I heard that you need to use j1 with the ps2toolchain, because it can't handle anymore than that.  I think that would be like a normal make command.


----------

