News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Is it possible to convert/create the Metroid LUA Script into an IPS patch?  (Read 9262 times)

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1400
    • View Profile
The title is pretty much self-explainatory.

My question is:
Is there a way that all the features added by the Metroid LUA script can be somehow converted or made into an IPS patch to have a full rom hack without the need of a Lua Script?

I ask this because my main emulator for NES roms is not compatible with LUA scripts, and I liked the idea of that script so much along with all its features that I was seeking for a way to convert it to IPS, but I haven't found anything.

Or maybe even editing the ROM and its addresses by taking the script as a "guide"?

Here is the download link for the Metroid LUA script for reference:
https://www.dropbox.com/s/b2kuma6zs89di8n/Metroid.lua
I struggled so much to get it, found it in a forgotten corner of the internet since the official website by Neill Corlett is no longer available, so I decided to upload it into my DropBox account for anyone to download. :)

Any suggestions as to make this possible would be greatly appreciated!
« Last Edit: October 16, 2014, 08:34:04 pm by ShadowOne333 »

FAST6191

  • Hero Member
  • *****
  • Posts: 2810
    • View Profile
Short version. Looking at the script then not really, it would be a full hack in which you need to find a hacker versed in the NES, and probably lua as well.

I am sure I could make a lua script that could be converted into a normal ROM hack with relative ease, however that one seems to have a fair bit of logic layered on top of simple reads and writes, indeed several full on if, while and other loops are in there. Now a lot of that does look like bounds/sanity checking but not all of it. I would certainly be thrilled to have something like that when setting about a hack, not least of all because I could probably port functions into the game and then have the script take care of the rest/help check, but you are not going to get an easy in.

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1400
    • View Profile
Short version. Looking at the script then not really, it would be a full hack in which you need to find a hacker versed in the NES, and probably lua as well.

I am sure I could make a lua script that could be converted into a normal ROM hack with relative ease, however that one seems to have a fair bit of logic layered on top of simple reads and writes, indeed several full on if, while and other loops are in there. Now a lot of that does look like bounds/sanity checking but not all of it. I would certainly be thrilled to have something like that when setting about a hack, not least of all because I could probably port functions into the game and then have the script take care of the rest/help check, but you are not going to get an easy in.
Actually, yeah, it is quite odd to find someone versed in LUA more than NES itself.

So the main problem would be the logical IFs?
You say they might be used to check or verify the read/write values and the issue would be adding those to the rom hack, right?

FAST6191

  • Hero Member
  • *****
  • Posts: 2810
    • View Profile
Simple IFs are not so bad but having to crowbar in a bunch of loops of various forms, and they get reasonably extensive at that, would be less than fun to asm hack into a NES game. This script is certainly not a "someone made a custom palette but could not be bothered to locate and alter the palette in the game proper" type lua script, or even a basic cheat that you might be able to put a little loop/hook in for and use it to hold the memory location changed by the cheat.

In that script a lot of the loops looked like they did more in the way of sanity and bounds checking, absolutely fantastic to have in code and I would encourage every coder to have them in basically all code until they can demonstrate they do not need it in a given instance. Embedded devices, much less adding to existing code running closer than not to the limits of the embedded device, would be one of those exceptions though. That means you could skip some of these checks out if you could be reasonably sure your code would not cause errors, for instance
Code: [Select]
--
        -- Lots of hours? Just peg it at 99:59:59
        --
        if hours > 99 then
            hours = 99
            minutes = 59
            seconds = 59
        end

That is not really all that necessary to hack that in, it was presumably simple enough (you have the entire code, and some comments on it, right there after all) but when rendered as ASM you might have some fun trying to get it in there. Such a thing is not an isolated incident within that script either.

Jorpho

  • Hero Member
  • *****
  • Posts: 4382
  • The cat screams with the voice of a man.
    • View Profile
I ask this because my main emulator for NES roms is not compatible with LUA scripts
So... Why not use another NES emulator?
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

Isao Kronos

  • Hero Member
  • *****
  • Posts: 1291
    • View Profile
because people use the emulators they use for a reason

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1400
    • View Profile
Simple IFs are not so bad but having to crowbar in a bunch of loops of various forms, and they get reasonably extensive at that, would be less than fun to asm hack into a NES game. This script is certainly not a "someone made a custom palette but could not be bothered to locate and alter the palette in the game proper" type lua script, or even a basic cheat that you might be able to put a little loop/hook in for and use it to hold the memory location changed by the cheat.

In that script a lot of the loops looked like they did more in the way of sanity and bounds checking, absolutely fantastic to have in code and I would encourage every coder to have them in basically all code until they can demonstrate they do not need it in a given instance. Embedded devices, much less adding to existing code running closer than not to the limits of the embedded device, would be one of those exceptions though. That means you could skip some of these checks out if you could be reasonably sure your code would not cause errors, for instance
Code: [Select]
--
        -- Lots of hours? Just peg it at 99:59:59
        --
        if hours > 99 then
            hours = 99
            minutes = 59
            seconds = 59
        end

That is not really all that necessary to hack that in, it was presumably simple enough (you have the entire code, and some comments on it, right there after all) but when rendered as ASM you might have some fun trying to get it in there. Such a thing is not an isolated incident within that script either.

If the Timer is going to be an issue my best bet would be to leave it out. As you said, it's not really necessary to hack that in and it's not like it is that important anyway, only if you want to go for the special ending but one can do just fine without the timer.

It is the OTHER features that got me interested, like the map, HUD layout, automap, pause screens and such. Really handy and really makes the game pop out from the original version and other hacks available.


So... Why not use another NES emulator?

Because there are NO NES emulators available for the Wii/Wii U that are compatible with Lua Scripts.
That's why, and I don't play on a computer.
My Wii U is my complete gaming machine for all my library and consoles I have so far, that's why I have everything in there.
« Last Edit: October 02, 2014, 12:45:30 am by ShadowOne333 »

FAST6191

  • Hero Member
  • *****
  • Posts: 2810
    • View Profile
I was not highlighting a specific issue as much as mentioning a curio in passing/expanding upon an earlier point. It is not going to happen and if you only want it for the Wii you would be better off adding lua support to the port of fceux the Wii has (I wondered if this was going to be a non PC emulation thing and wanted to see what happened with the Wii port, bug tracker says "won't fix" when people bring up lua.

"My Wii U is my complete gaming machine for all my library and consoles I have so far, that's why I have everything in there."
Though the Wii does serious damage in the emulation world, still not sure where I would place it relative to the xbox though, this thread would appear to be evidence to the contrary.

puzzledude

  • Sr. Member
  • ****
  • Posts: 308
    • View Profile
Quote
My Wii U is my complete gaming machine for all my library and consoles I have so far, that's why I have everything in there.
To bad. Wii emulators are far behind from PC emulators. Another inconvenience on Wii is the delay. When you press a button on the controller it takes a while before it actually works. The same for accuracy of the game-pad (left up right down). One press of this button will for instance move Link on Alttp to far. This means you will have a hard time in any pit-rooms where you need to be accurate on platforms.

Another inconvenience is that my picture was constantly forced into 16:9, while Snes has it on 4:3. I thus had a very bad time playing Snes on the Wii and a 16:9 Tv. Far behind from what I've experienced on PC with the Usb joystick.

dACE

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
Since the Metroid plus hack from Snarfblam already incorporates map (and automap) - your simplest approach must be to hack in what you are missing into that hack.

Since the rom is enlarged - you should have plenty of space. Good Luck!

/dACE

Grimlock

  • Sr. Member
  • ****
  • Posts: 361
  • Graphics Artist, Level Designer
    • View Profile
Re: Is it possible to convert/create the Metroid LUA Script into an IPS patch?
« Reply #10 on: October 10, 2014, 12:45:50 am »
You can get a lot of metroidy information at the "metroid construction" forum.

http://forum.metroidconstruction.com/index.php

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1400
    • View Profile
Re: Is it possible to convert/create the Metroid LUA Script into an IPS patch?
« Reply #11 on: October 16, 2014, 08:34:52 pm »
You can get a lot of metroidy information at the "metroid construction" forum.

http://forum.metroidconstruction.com/index.php
I am aware of that website and been checking it for a while, but sadly no hack in that site satisfies my picky self :/
XD

SpiderWaffle

  • Jr. Member
  • **
  • Posts: 26
    • View Profile
Re: Is it possible to convert/create the Metroid LUA Script into an IPS patch?
« Reply #12 on: November 05, 2014, 06:44:04 pm »
Is most of the issue over converting LUA script into ASM? Couldn't a lot of the major LUA commands be chunked into ASM for NES if they haven't already? Seems like a basis of substitution could do most of the work for you, instead of trying to replicate it all piece by piece from scratch.
« Last Edit: November 10, 2014, 04:11:50 pm by SpiderWaffle »

Gideon Zhi

  • IRC Staff
  • Hero Member
  • *****
  • Posts: 3525
    • View Profile
    • Aeon Genesis
Re: Is it possible to convert/create the Metroid LUA Script into an IPS patch?
« Reply #13 on: November 05, 2014, 07:51:59 pm »
The issue is that the lua basically just draws on top of the emulator view; the game itself remains unchanged. It adds functionality directly through the emulator, but it doesn't add it to the game.

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1400
    • View Profile
Re: Is it possible to convert/create the Metroid LUA Script into an IPS patch?
« Reply #14 on: November 05, 2014, 11:32:57 pm »
The issue is that the lua basically just draws on top of the emulator view; the game itself remains unchanged. It adds functionality directly through the emulator, but it doesn't add it to the game.
I was not aware of that.
So basically what the script does is take information from the game (my bet is it uses RAM addresses) and then outputs an overlapped graphic into the emulator's screen, am I right?

If that's so... Then it might be easier to just port the LUA feature to FCEUGX.
Is the FCEUX SVN open source so I can take a look at the code for Lua scripts?

EDIT:
Found it:
http://sourceforge.net/p/fceultra/code/HEAD/tree/fceu/branches/fceux-2.2.2/src/lua/

Now to see how can it be ported to the Wii version (FCEUGX)...
« Last Edit: November 05, 2014, 11:42:17 pm by ShadowOne333 »

SpiderWaffle

  • Jr. Member
  • **
  • Posts: 26
    • View Profile
Re: Is it possible to convert/create the Metroid LUA Script into an IPS patch?
« Reply #15 on: November 10, 2014, 05:05:34 pm »
Ya I'm pretty sure that's essentially how his LUA script works, snarfblam has been pretty good with communication in past if you wanted to find out more. Let me how this is going, I'm really interested in metroid hacking, snarfblam has really made some great tools.

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1400
    • View Profile
Re: Is it possible to convert/create the Metroid LUA Script into an IPS patch?
« Reply #16 on: November 11, 2014, 08:17:56 pm »
Ya I'm pretty sure that's essentially how his LUA script works, snarfblam has been pretty good with communication in past if you wanted to find out more. Let me how this is going, I'm really interested in metroid hacking, snarfblam has really made some great tools.
Who's snarfblam? The original author for FCEUX?

gravity

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Is it possible to convert/create the Metroid LUA Script into an IPS patch?
« Reply #17 on: November 12, 2014, 01:44:31 am »
He's the author of Editroid and the Metroid Plus hack.

I'd be very interested in seeing a LUA capable NES port on the Wii myself. I have an old CRT tv with a much bigger screen than my LCD monitor, and I simply find myself enjoying NES/SNES era console games on there via the Wii more than when I play them on pc.

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1400
    • View Profile
Re: Is it possible to convert/create the Metroid LUA Script into an IPS patch?
« Reply #18 on: November 12, 2014, 10:50:32 am »
He's the author of Editroid and the Metroid Plus hack.

I'd be very interested in seeing a LUA capable NES port on the Wii myself. I have an old CRT tv with a much bigger screen than my LCD monitor, and I simply find myself enjoying NES/SNES era console games on there via the Wii more than when I play them on pc.
LOL
Silly me, I forgot I even messaged him about Metroid Plus. XD
Yeah me too, I would love to see LUA implemented into FCEUGX due to the wide range of scripts available. But until someone finds a proper way to port it, it's just a dream...

SpiderWaffle

  • Jr. Member
  • **
  • Posts: 26
    • View Profile
Re: Is it possible to convert/create the Metroid LUA Script into an IPS patch?
« Reply #19 on: January 25, 2015, 04:34:17 pm »
Any developments on this front?