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

Author Topic: Lua?  (Read 1897 times)

rainbwsprinklez

  • Jr. Member
  • **
  • Posts: 24
  • Anything is possible :)
    • View Profile
Lua?
« on: December 21, 2016, 09:14:22 am »
I know VERY basic lua. Can I somehow make a hack using this? My main is Donkey Kong Country. I want to make a hack that has an individual level timer to aid speedrunners. I know how to do this in lua, but how can I apply that to this?
Anything is possible :)

Jorpho

  • Hero Member
  • *****
  • Posts: 4146
  • The cat screams with the voice of a man.
    • View Profile
Re: Lua?
« Reply #1 on: December 21, 2016, 09:51:04 am »
I did a Google search for <snes emulator with lua scripting> and came up with http://tasvideos.org/LuaScripting.html , which suggests that SNES9x , BizHawk, and "Lsnes" support LUA scripting.
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

rainbwsprinklez

  • Jr. Member
  • **
  • Posts: 24
  • Anything is possible :)
    • View Profile
Re: Lua?
« Reply #2 on: December 21, 2016, 01:39:37 pm »
I did a Google search for <snes emulator with lua scripting> and came up with http://tasvideos.org/LuaScripting.html , which suggests that SNES9x , BizHawk, and "Lsnes" support LUA scripting.

Yes, there are many emulators that support lua, but what I want is to hack a rom to use aspects that i could implement in lua
Anything is possible :)

FAST6191

  • Hero Member
  • *****
  • Posts: 2577
    • View Profile
Re: Lua?
« Reply #3 on: December 21, 2016, 01:48:43 pm »
If you have a simple timer then it would probably be easier to have the game reach out and start one when the level starts and ends rather than trying to crowbar one into the game.
Various ways but likely there will be a value that corresponds to the level in RAM somewhere and changes with the level. You then find this by whatever means (most would start with cheat making and go from there) and then put a if internal value does not equal previous then end clock and start new one, maybe also a stop clock at the point the finish line is touched rather than when the next level is loaded as that might be a few seconds. Might be fun if you also have to modify to handle savestates though probably not so bad as you can note the time at the time the savestate is made and restore it later.

STARWIN

  • Sr. Member
  • ****
  • Posts: 449
    • View Profile
Re: Lua?
« Reply #4 on: December 21, 2016, 02:14:54 pm »
You can't apply the Lua parts in your Lua script to hacking the rom. Only useful pieces of information in such a script would be memory addresses that the script touches and meanings of the values within those addresses.

To make the game itself do something you'd have to write the functionality in the machine code (=asm) of the console and insert it so that it gets called and won't overwrite anything useful the game has in memory already. Stick with the lua script method if you can, because that should be much easier and less intrusive.

rainbwsprinklez

  • Jr. Member
  • **
  • Posts: 24
  • Anything is possible :)
    • View Profile
Re: Lua?
« Reply #5 on: December 22, 2016, 10:47:04 am »
Various ways but likely there will be a value that corresponds to the level in RAM somewhere and changes with the level.

Yes, I have minor experience with TASing and there exists an overall level frame counter, so I could just use that. Listen guys, I'm EXTREMELY new to hacking. This is my first one. I basically wanted to make a timer hack for in-game, withOUT lua, so it could ultimately be done on console.
Anything is possible :)

mz

  • Sr. Member
  • ****
  • Posts: 436
  • Whore
    • View Profile
Re: Lua?
« Reply #6 on: December 22, 2016, 10:57:59 am »
I'd try modifying the life or banana counters to make them appear all the time and print the level timer instead of lives or bananas.

Get a SNES emulator with debugger, put a read breakpoint on the life/banana RAM position and you'll find the routine that prints them on screen. Then modify it accordingly...
There has to be a better life.

Jorpho

  • Hero Member
  • *****
  • Posts: 4146
  • The cat screams with the voice of a man.
    • View Profile
Re: Lua?
« Reply #7 on: December 23, 2016, 01:52:27 am »
I basically wanted to make a timer hack for in-game, withOUT lua
You sure chose a strange way to present your query.

The only way to get new code into an existing ROM is with raw assembly language – 65c816 assembly in the case of the SNES.  Even if you could start with a programming language like Lua and automatically generate appropriate assembly code, it would likely be insufficiently optimized to fit in whatever minuscule space would be available in a game ROM.
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!