Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Disney's Toy Story (Super NES)
- -- by Jimmie1717
- -- lsnes rr2-Beta23
- -- This will only work with the NTSC-U version of the game.
- print("Disney's Toy Story (Super Nintendo Entertainment System)\nby Jimmie1717");
- -- Globals
- readByte = memory.readbyte;
- readSByte = memory.readsbyte;
- readWord = memory.readword;
- readSWord = memory.readsword;
- readDWord = memory.readdword;
- readSDWord = memory.readsdword;
- writeByte = memory.writebyte;
- writeWord = memory.writeword;
- writeDWord = memory.writedword;
- -- RAM Addresses
- local addrs = {
- general = {
- level = 0x7E001A,
- bonus_stars = {
- total = 0x7E0010,
- level = 0x7E000A
- }
- },
- woody = {
- position = {
- x = 0x7E1730,
- y = 0x7E1734
- },
- velocity = {
- x = 0x7E1780,
- y = 0x7E1784
- },
- state = 0x7E17B0,
- lives = 0x7E001E,
- health = 0x7E001C
- },
- screen = {
- position = {
- x = 0x7E004A,
- y = 0x7E004C
- }
- },
- level_data = {
- [12] = {
- position = {
- x = 0x7E00BA,
- y = 0x7E00BE
- },
- velocity = 0x7E00C1
- }
- }
- };
- -- Use these to define the base location of where text should appear.
- -- i.e. 0, 0 is the top left of the screen.
- local x = 3;
- local y = 0;
- local inputs = {"", "", "", "", "", "", "", "", "", "", "", ""};
- local inputn = {"B", "Y", "s", "S", "U", "D", "L", "R", "A", "X", "l", "r"};
- function on_input()
- for i = 1, 12, 1 do
- if (input.get(0, (i - 1)) == 1) then
- inputs[i] = inputn[i];
- else
- inputs[i] = "";
- end
- end
- end
- -- Core function, this is where the magic happens.
- function on_paint()
- -- Draw two sets of all the info
- -- One is black and offset by 1 pixel both horizontal and vertical.
- -- This makes it easier to read on any color background.
- -- Order matters here as they are drawn in the order you specify.
- drawInput(x + 1, y + 1, 0x00000000, 0xFF000000, inputs);
- drawInput(x, y, 0x00FFFFFF, 0xFF000000, inputs);
- drawText(x + 1, y + 1, 0x00000000, 0xFF000000);
- drawText(x, y, 0x00FFFFFF, 0xFF000000);
- end
- gui.repaint(); -- Update the GUI asap.
- function drawText(x, y, foreColor, backColor)
- -- Text
- gui.text(x, y + 24, string.format("Level:"), foreColor, backColor);
- gui.text(x, y + 36, string.format("Stars (l):"), foreColor, backColor);
- gui.text(x, y + 48, string.format("Stars (t):"), foreColor, backColor);
- gui.text(x, y + 72, string.format("Screen X:"), foreColor, backColor);
- gui.text(x, y + 84, string.format("Screen Y:"), foreColor, backColor);
- gui.text(x, y + 108, string.format("Woody X:"), foreColor, backColor);
- gui.text(x, y + 120, string.format("Woody Y:"), foreColor, backColor);
- gui.text(x, y + 132, string.format("Velocity:"), foreColor, backColor);
- -- Values
- gui.text(x + 96, y + 24, string.format("%6d", (readWord(addrs.general.level) + 1)), foreColor, backColor);
- gui.text(x + 96, y + 36, string.format("%6d", readWord(addrs.general.bonus_stars.level)), foreColor, backColor);
- gui.text(x + 96, y + 48, string.format("%6d", readWord(addrs.general.bonus_stars.total)), foreColor, backColor);
- gui.text(x + 96, y + 72, string.format("%6d", readWord(addrs.screen.position.x)), foreColor, backColor);
- gui.text(x + 96, y + 84, string.format("%6d", readWord(addrs.screen.position.y)), foreColor, backColor);
- if (readWord(addrs.general.level) + 1 == 11) then
- gui.text(x + 96, y + 108, string.format("%6d", readWord(addrs.level_data[12].position.x)), foreColor, backColor);
- gui.text(x + 96, y + 120, string.format("%6d", readWord(addrs.level_data[12].position.y)), foreColor, backColor);
- gui.text(x + 96, y + 132, string.format("%6d", readSByte(addrs.level_data[12].velocity)), foreColor, backColor);
- else
- gui.text(x + 96, y + 108, string.format("%6d", readWord(addrs.woody.position.x)), foreColor, backColor);
- gui.text(x + 96, y + 120, string.format("%6d", readWord(addrs.woody.position.y)), foreColor, backColor);
- gui.text(x + 96, y + 132, string.format("%3d,%2d", readSWord(addrs.woody.velocity.x), (readSWord(addrs.woody.velocity.y) * -1)), foreColor, backColor);
- end
- end
- function drawInput(x, y, foreColor, backColor, i)
- -- input: U D L R s S Y B X A l r
- -- index: 5 6 7 8 3 4 2 1 10 9 11 12
- gui.text(x, y, string.format("%1s%1s%1s%1s%1s%1s%1s%1s%1s%1s%1s%1s", i[5], i[6], i[7], i[8], i[3], i[4], i[2], i[1], i[10], i[9], i[11], i[12]), foreColor, backColor);
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement