Post subject: How do I enter this Gameshark code?
Joined: 8/3/2009
Posts: 158
I searched the forum, and the only threads asking about how does Bizhawk work with Gameshark, did not address this: How exactly do I enter this PS1 gameshark code? D00B6F18 0600 800B6F18 0100 I know about dropping the first two characters, problem is, if I do, then the addresses are exactly the same and Bizhawk doesn't allow duplicate addresses. Is there a workaround?
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
you can't enter gameshark codes in bizhawk. you can convert some gameshark codes to raw cheats this code is two parts. if($B6F18==$0600) //D00B6F18 0600 $B6F18 = $0100; //800B6F18 0100 This can't be converted to raw cheats. You might be able to approximate it by removing the first part. But it might not work. You might be able to approximate it by manually tweaking that value at the right time in the hex editor, if we had a systembus memorydomain on psx, which it seems we do not. You could probably convert that address to a main ram address using google-fu and a PSX memory map and then use the hex editor.
Lil_Gecko
He/Him
Player (94)
Joined: 4/7/2011
Posts: 520
Codes starting with a D are "if" codes. You got to write something in lua to make it work.
while true do
if memory.read_u16_le(0xB6F18)==0x0600 then
memory.write_u16_le(0xB6F18,0x0100)
end;
emu.frameadvance();
end;
EDIT : not fast enough...
Joined: 8/3/2009
Posts: 158
zeromus wrote:
you can't enter gameshark codes in bizhawk. you can convert some gameshark codes to raw cheats this code is two parts. if($B6F18==$0600) //D00B6F18 0600 $B6F18 = $0100; //800B6F18 0100 This can't be converted to raw cheats. You might be able to approximate it by removing the first part. But it might not work. You might be able to approximate it by manually tweaking that value at the right time in the hex editor, if we had a systembus memorydomain on psx, which it seems we do not. You could probably convert that address to a main ram address using google-fu and a PSX memory map and then use the hex editor.
I tried removing the top code, but it didn't work. It's a code to always place 1st in a racing game, so I guess both lines are needed. If I could enter both addresses at the same it maybe could work, but even if I could do that, I don't know if it would really need those two characters GS codes have at the beginning. Which begs the question I'm sure other people have asked before, why not include a way to enter Gameshark codes directly?
Lil_Gecko wrote:
Codes starting with a D are "if" codes. You got to write something in lua to make it work.
while true do
if memory.read_u16_le(0xB6F18)==0x0600 then
memory.write_u16_le(0xB6F18,0x0100)
end;
emu.frameadvance();
end;
I don't know what LUA is, where can I find that option?
Experienced player (538)
Joined: 5/12/2005
Posts: 707
Lua is a programming language. You can make a file called "something.lua" and put code lines there and load it through bizhawk while playing a game.
Lil_Gecko
He/Him
Player (94)
Joined: 4/7/2011
Posts: 520
Indeed. Write the code in a text file. Call it Whatever.lua Then in Bizhawk, go to Tool => Lua Console and load it. From what I can tell the code seems to say something like : If you're 6th then change it to first. If you want to always be first, maybe try the code B6F19 set to 01.
Joined: 8/3/2009
Posts: 158
Ok, so I open a text file, enter the lines Lil_Gecko posted, change the name to whatever.lua, and then how do I load it? I don't see any option to load anything other than games or save states. Or do I need an external program for that? *edit* Crap, there it is on the tools menu. Yeah I see it now. Thanks. I'll try it and if it works, I can just modify what you posted to include any address, right? What if instead two addresses like the one I posted, there are 4 or 6 following the same pattern? Do I just repeat
if memory.read_u16_le(0xB6F18)==0x0600 then
memory.write_u16_le(0xB6F18,0x0100) 
with the additional addresses?
Lil_Gecko
He/Him
Player (94)
Joined: 4/7/2011
Posts: 520
If it's a D something code followed by a 8 something code, then yes. But don't forget the
end;
to close the statement.
Joined: 8/3/2009
Posts: 158
Ok so for example, I'm going to use all X's for the second set:
while true do
if memory.read_u16_le(0xB6F18)==0x0600 then
memory.write_u16_le(0xB6F18,0x0100)
end;
if memory.read_u16_le(0xXXXXX)==0x0600 then
memory.write_u16_le(0xXXXXX,0x0100)
end;
emu.frameadvance();
end;
Ok so that's only if the first line is a D, and the second an 8. What if it's reversed (if that's even possible)? What about codes where instead of an 8, there's a 3. Such as: D00B6F18 0600 300B6F18 0001 Does it work the same?
Lil_Gecko
He/Him
Player (94)
Joined: 4/7/2011
Posts: 520
The code you wrote in Lua would be the equivalent of D00XXXXX 0600 800XXXXX 0100 Can't be reversed. D something means a "if" condition on the code beneath it. If a code starts with a 3, it means it's a single byte address. So in lua it would be
if memory.read_u16_le(0xB6F18)==0x0600 then
memory.writebyte(0xB6F18,0x01)
end; 
Joined: 8/3/2009
Posts: 158
Thanks for the info. However, whenever I select Lua, I get this error: And then I get this and the emu crashes:
Lil_Gecko
He/Him
Player (94)
Joined: 4/7/2011
Posts: 520
For the errors, I'm not the one to ask unfortunately. If I had to guess, I'd say, there is a problem with your lua51.dll Check if you have it in your DLL folder and try to redownload it.
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
sounds like someone hasnt run the prerequisite installer
Joined: 8/3/2009
Posts: 158
Ha, no I didn't. I had the emu 'installed' a long time ago, and since the emu worked just fine, I just I assumed I did everything I needed to do back then. I just installed it and I'm still getting the same errors though.
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
http://www.dependencywalker.com/ drag the lua51.dll in there and see if anything in the treeview is red
Joined: 8/3/2009
Posts: 158
Yep.
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
that's not the treeview, thats the listview, but it showed me what i needed, as long as it was scrolled up all the way. bleh delete msvcr100.dll from your syswow64 and system32 directory and then run the prerequisite installer again.
Joined: 8/3/2009
Posts: 158
Just did it all that, and nothing. Same issues. I haven't restarted the PC though, but I can't do it right now because I'm in the middle of something. Once I do, I'll test again.
Joined: 8/3/2009
Posts: 158
I restarted and windows just re-downloaded those files again. I'm using Win7 64bit by the way.
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
scan your system for malware and then disable your security software and stop using hacked feos builds. after that, i may have to teamviewer to your PC to sort this out,
Joined: 8/3/2009
Posts: 158
Thanks for being so diligent, but I've never needed to use lua before and as much as I want to be able to use those specialized Gameshark codes, it's not worth all this trouble I'm giving you guys.