Posts for BadPotato

1 2 3 4 5 6
22 23
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
If you want add a better security level you can simply make some hashcode function to generate some string from the serialized object, then you add this string to your favorite file format. Then, when you want to restore the serialized object you should be able to valid if the file is fine. Thought, some hacker could still been able to modify their internal game state(with external program) and ask Pyrel to generate the savestate, so a malicious game function could be triggered on the first execution...(or simply do all the fuzzy math manually to get the right hashcode) But, that's still very tricky and I believe this is a perfectly good enough solution if you don't want to do some custom rules everywhere that might require some heavy maintenance.
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
Master of Puppets wrote:
Keyboard does work, but that's not quite fun/effective for playstation games.
If the Keyboard work, you can use Joy2key. As for the PSX project been dead, I thought there were some people working on it at the BizHawk core, but this is probably going to be a long work in progress, before we get something here(actually I have no idea...) Thought, must problem asked here should have some sort of workaround, despite the game not been supported. If you can't run any game correctly, must likely that there something missing in your setting.
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
Yup, I'll put it this weekend. I just got more busy than expected. edit: Arg, Sorry guys I got terribly sick lately and I didn't even check the code since. But here's a preview. The gui is almost over, but right now it doesn't do anything useful. In order to get it work just edit the "movieName = [[path]]" variable in pcsxrrWorkflowConfig. That should do it.
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
Peux-tu préciser quel vidéo? Je crois qu'il en a poster plusieurs... Sinon, dans le but "d'encoder" une vidéo c'est possible d'utiliser les scripts Lua pour: -Afficher les valeurs(ex: point de vie, expérience, etc..) propres au jeu à l'écran. -Mettre des commentaires sous-titrés. -Montrer les hitboxs des ennemis/joueurs. -Afficher une mini-map du jeu à l'écran. -Créer un HUD personnalisé. -Concevoir un "camerahack" quand le jeu ne réussis pas à suivre l'action(exemple) -Faire un bot qui joue à ta place(exemple avec Mario Paint) -Faire un script "resync" de pcsxrr... Néanmoins, normalement les Lua script sont plus souvent utilisé pour assister directement la personne qui conçois le TAS, que l'encodeur. La plupart des "utilisations de bases" ne demandent pas trop de connaissance de programmeur. Il suffit d'avoir un peu de temps et de volonté pour apprendre leur fonctionnement et voilà. Au bout du compte, c'est simplement un outil de plus qui est complètement optionnel pour TASer. La documentation de Fceux offre un petit tutorial en anglais, si ça t'intéresse.
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
So, I rewrited a big part of the code. Now I just need clean up some stuff and you guys should be able to enjoy the new workflow. Meanwhile, here's a somewhat crappy encode of Bushido Blade 2. And here's the list of the 161 checkpoints for this 4minutes movie(with 15 "tolerable" frame desync):
{500, 1000, 1500, 1921, 2000, 2500, 2685, 2804, 2828, 2947, 3000, 3072, 3197, 3326, 3356, 3453, 3500, 3578, 3705, 3831, 3961, 4000, 4090, 4217, 4344, 4469, 4500, 4596, 4725, 4852, 4880, 4977, 5000, 5105, 5235, 5360, 5500, 5612, 5741, 5868, 6000, 6122, 6247, 6279, 6377, 6431, 6500, 6543, 6662, 6787, 6916, 7000, 7043, 7170, 7295, 7422, 7500, 7549, 7695, 7735, 7823, 7950, 8000, 8075, 8202, 8329, 8456, 8500, 8583, 8710, 8835, 8891, 9000, 9147, 9266, 9401, 9500, 9520, 9649, 9774, 9899, 10000, 10024, 10151, 10279, 10407, 10500, 10532, 10659, 10786, 10911, 11000, 11038, 11165, 11290, 11417, 11500, 11543, 11669, 11794, 11919, 12000, 12044, 12169, 12294, 12419, 12500, 12544, 12669, 12721, 12795, 12819, 12887, 12941, 12981, 13000, 13045, 13100, 13243, 13303, 13386, 13410, 13500, 13529, 13553, 13593, 13672, 13698, 13748, 13815, 13839, 13958, 13982, 14000, 14036, 14101, 14125, 14245, 14373, 14397, 14500, 14572, 14659, 14683, 14735, 14749, 14802, 14826, 15000, 15019, 15073, 15112, 15174, 15311, 15375, 15500, 15530, 15554, 15614, 15628, 16000}
Checkpoint at every 500 frame are obselete and should be removed soon(this way, we should be able to shorten the list by around 33 checkpoints). But, since we got a case here to study here, I would like that you check the movie and listen and see if you can spot some weird sound glitch. Maybe I never took the time to explain why all this weird sound happen, so let me explain. A minimal number of desync improve sound quality over visual frame, because when we "savestate" a frame from the TAS SPU plugin, the sound for that particuliar frame is kept in the memory. Then Eternal SPU has to handle sound and sometime SPU Eternal can't do much, since he can't get real info sound data from the past. I should have kept a log of all the desync that has been "tolerated", but I can say that there is still a bunch. That's why I believe that getting more "TAS-desyncproof-savestate" by lowering the value of "tolerable desync" at 1 is a bad idea if you don't want to lower the sound quality. All these cut in the sound memory make the audio sometime even less natural and annoying, even if it's still probably better than using TAS SPU all the way. Right now, as long as we use TAS SPU savestate, we want to get the savestate list as short as possible, while still matching the movie to avoid these "sound cut" issue. Thought, as I mentionned earlier as a future experimentation. It would be possible to fix *must* of these issue by using "Eternal savestate" at desync point, if they playback from a TAS savestate around ~30frame(1 second) or more(the longer affect the savestate "desyncless" lifetime), so they can have a chance to buffer the last music/SFX, etc.. Now the reason, why I said *must* is because sometime there won't be any effect, or worse it... I also fear that this might cause crash for some game... so that's why I would like that we try to encode some game with what we currently have. Breath of Fire, Symphony of Night, some 3D platformer, CD switch feature etc... all these kind of fame should be tested, first. As I said, I'll try to get the code a bit more solid before release. If my shedule isn't to heavy, you can expect an update by the end of the week.
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
Around 2 year ago, I did a test TAS up to the 2-3 level(I'm still unsure about the exact number), but somehow now I couldn't get it to sync. I might try to check that again. That said, on level 1 when you fight the first dude in the house, I believe it's faster to exit by the normal door and use the hook, than using the entrance at roof again.
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
Ok, I played around with the switchspu function and yeah... I got some weird result. I believe that function could be improved, but for now, double instance workflow seem the way to go. This time, I'll use socket and I started to read how ZMQ work, as I mentionned on the first page of this thread. This is what I should have done right in beggining, anyway. One more thing, anyone know how to disable ASSERT from external lib, when your are in "debbuging mode" with VisualStudio 2008? I keep getting this issue where the debbuger keep poping up some message that some code is not 100% safe(relevant from loading savestate, etc..) and it simply it refuse to ignore them. Thought, I don't have this problem at all in "Release mode". edit1: Well, it's seem that I got these assert issue, only when a bad pointer might not be null at the startup of the application... I might need some tip to know if there any clean way to get around this problem. edit2: I succesfully managed to get 2 instance communicate thought tcp socket with lua-zmq, but I just found out an another fantastic API, called winapi... it even seem to work well with the IPC protocol, so I'll probably use it instead. edit3: Sigh... Using both socket or Pipe asynchronously require at some point to relay manually on thread. It certainly can be done, but I believe we should avoid to do this as much as possible for such a simple task. Lua is basically a language designed without multithreading feature anyway and I think it might create some problem sooner or later. So I'll just use the clipboard to handle communcation(for desync point) instead of xml/socket/pipe. Thought, if I find a better idea later, clipboard should be replaced. edit4: Well, actually... I managed to setup somekind of file token and it seem to work. So, no clipboard, socket or anything complicated will be used.
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
Hmm, et tu te base sur quoi pour dire que c'est 100% un jeu sans chance? Ça serait vraiment un comble pour un RPG d'avoir aucune notion de chance, non? Selon cette vidéo, Lupin semble pouvoir faire des dommages critiques de temps à autre. Ensuite, si on lit cette gamefaq, on peut voir ceci:
This is like the first battle, but harder. Just use Incendio as your main spell, and you might need to heal. Also, as Harry, using Diffindo works EXTREMELY well. I got a Critical Hit with it and it did 102 SP damage!
J'ai pas jouer au jeu, mais selon les critiques le jeu est assez court. Donc d'après moi, il y a quand même un certain potentiel pour un TAS intéressant.
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
Aktan wrote:
I believe I've seen this before and it was due to loading the state while the game is not rendering from the initial game load, so loading a bit later fixed it.
Erf, I really don't get it what did just happened, but somehow I got it fixed by replacing my plugin folder by a backup. I'm completly clueless how come I even got this issue, since I've been testing it with different gpu plugin, but oh well. Now, these issue out of the way, one of the only feature missing would be the ability to relay only on savestate from RAM instead of getting pcsxrr alway using on slot from the sstate folder, so we get a bit less of IO bandwidth trafic. But I gotta admit that I'm unsure how we should proceed for this, yet. Should we just duplicate the savestate 0,1,2,3,4,5,6,8,9 into memory or making indepedant slot like "100","101","102"... etc ? How to get these "savestate/data object" shared thought IPC or any kind of API and from pcsxrr instance to an another? Despite Nach you woke on about some idea for this, I really can't tell if such a thing is possible. So I'm thinking about to rewrote my Lua script and aiming for single instance, so we can at least test how switchspu on fly is efficient while minalizing the risk of memory leak. Also, since I got more tool to work with, the process should be easier to make. My only last concern was to get pcsx.redrawscreen() to work, so I can reload a savestate without having to manage more framedelay(you can test by yourself, you alway has to frameadvance at least once for a normal loadstate to work) or doing weird experiment on the lua side... but yeah, framedelay management is fine. Expect more progress soon. Oh and one last thing, someone still have a backup from the old dammit script from there? luapastey seem to be down :/
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
Aktan wrote:
Just to make sure, the savestates made are always from TAS SPU, and not Eternal SPU, right? Might be another misunderstanding, but using savestates from Eternal SPU will probably cause more desyncs, hence why I am making sure...
Well, clarification is good. And nope, for now I dont plan to use Eternal SPU savestate. If I use them, that would be of course few frame after loading a TAS SPU savestate, but this still an another experimental idea. Right now, I just found out the beatiful GUI used by TheAxeMan in his Crystalis run and I'm amazed how fluent this run well in realtime. So I tried to get the Iup with some auxlibs to work on pcsx-rr(just like fceux) and it run fine until you want to stop the script, but I guess that could be manageable. But still, I'll prefer to look foward for these IPC function. That said current build has some ridiculous bug and it doesn't seem to be caused by feos's recent change. Here's what to do in order to reproduce: Replay a movie from BB2 or any game. Wait until the movie get a bit advanced into the game. Make a normale savestate using the hotkey. Example: use Shift+F1(Default) Close pcsxrr completly. Start pcsxrr again Replay the movie Load the movie right away. You will see at this point that the screen is filled with garbage and some random texture.
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
I should point out that using a second savestate(from the eternal plugin) at the desync point is just a little technical detail to me, since it doesn't enhance to much the workflow, so we can do it your way as well. If I get my tool right, I should be able to make different kind of setting, so we can experiment several way of when taking savestate, etc. That said, I 100% approve the great capacity of this diagram since it should work, but sadly there's still an important flaw that we should consider with the "backward checkpoint": Note1: All green bar are also desync Note2: Some major desync will only be fixed by a savestate at desync, in such case... we might just have wasted all the previous savestate trying to bypass the desync himself. So yeah, the best matchup at some point would probably to anticipate if there a specific "strategy" pattern to favorise. Some strategy would be -Use the backward tas-savestate for minor desync, -Use eternal-savestate(that is actually processing frame from a backward tas-savestate) for minor desync point -Use tas-savestate directly for major desync point Note: the difference between major and minor desync would be, that the game is likely to desync in the next "few" frame(let's say max 15 frames) Also, keep in mind that our goal is trying to make plan for getting an efficient "list of savestate" to load while replaying the at last pass of the run in an automated way. For testing purpose I'll just make the workflow as simple as possible using savestate at desync point, but step by step and while testing with several game, we should be able to enhance the workflow to make it better, while using the best strategy avalaible, avoid possible issue, etc.. --- That said, I'm pretty sure I just spotted why we kept getting memory leak issue before. Since I have no idea how to copy/paste a Call Stack from VS2008, here's the screenshot. The relevant info is: >pcsx.exe!savestate_create(lua_State * L=0x010a3740) Line 1256 + 0x9 bytes C++ which is actually this line from LuaEngine.cpp(around line 1256):
	// The filename was allocated using malloc. Do something about that.
	free(filename);
For some reason my debugger don't want to run this line. It alway seem be to be ignored/skipped and it seem that the guy to blame is malloc. What's up with that?
edit: might not be relevant actually
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
Aktan wrote:
Even at setting of 1 for tolerable desync, the script should be going backwards at most 15 frames to cover the sound delay.
From some some of my old experiments, there's 2 way to fix the "sound delay" issue. Either we proceed with that "scalable" tolerable desync(the "good enough" concept). Or: Make a TAS-checkpoint a bit *before* the desync, then load it with the sync script, so eternal can rearrange the sound output from the last TAS-checkpoint savestate and when it reach the desync point... make an another checkpoint, so the sound is perfectly fluent. Way before, I tried to attempt this second solution, but I had several crash from pcsxrr, since the emulator couldn't support all the multiple savestate/loadstate going on. Right now, I just want our current workflow to work so we can test how good our current workflow is with several game. As for example, I think I encounter of these sound issue in the Breath Of Fire 3 run, but I don't remember where exactly this happen. I guess, once the workflow is fully setup, I could try to reproduce this.
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
Here's an another version that should work better with lua:
Language: lua

while true do lastButtonPolled = input.getlastbuttonpolled(); lastPad1Polled = lastButtonPolled["pad1"]; lastPad2Polled = lastButtonPolled["pad2"]; print("[" .. emu.framecount() .. "] " .. lastPad1Polled) pcsx.message("[" .. emu.framecount() .. "] " .. lastPad1Polled) pcsx.frameadvance(); end
With the Peops driver 1.4 you should be able to see your input on the top-left corner, but you should also be able to see the input in the lua console. Here's a screenshot. Note: Actually, your movie desync around frame 3000 for some odd reason, thought before I'm sure I was able to sync all the way(even with the "no sound" spu plugin and a previous pcsxrr version, the movie didn't sync)
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
Well, I guess the tolerable desync concept is somewhat debatable, so far all my script had 15 as value, so I could bypass some other annoyance like extended sound glitch. I'll probably just add a setting for the tolerable desync, where minvalue would be 1 so we can get a checkpoint as soon as there a desync. This way, we can see what kind of "audio output" we shall get from one game to an another. So it should be fine.
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
Ok, after a small talk with feos we both agreed on what function we needed, so I edited my previous post. As discussed, we also think that state_save/state_load IPC function need to store the savestate in RAM.
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
That new workflow seem better than my previous one. Should be good. As for implements this, it seem there still several way to do it. Right now, Nach told me about adding IPC interface to pcsxrr and I'm very interessed, so I can basicly manage the WorkFlow without Lua assistance and from an external app(in Java or C#). So right now, I'll be looking foward to his next if he can add some function like: frame_num() frame_hash(), (note: mine from lua could probably get optimised to run faster...) state_save(path), (note: path is required, so we can store desync elsewhere) state_load(index) sleep(seconds) (note: later I'll investigate if there a way to "yield" without completly freeze the app, but for now sleep is good enough) Meanwhile, I'll continue to add some Lua function, so if for wathever reason I dislike IPC, I can go back to Lua with a little bit less of overhead. I'm also thinking about adding a easier feature to show frame input, for game that doesn't support the GPU TAS and must use OpenGL2 and have to use weird way to show input like this.
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
gui.hashframe() is now added in r582. This new function is a bit faster than using gui.gdscreenshot(), but somehow still not as fast as the the snapshot from the plugin feature, that I tested the other day. While makeNormalSnapshotPNG() and loading the snap in lua. Also, a nice addition that I am thinking would be a movie.load("movie.pxm"). Such function would help a lot when testing special case where a desync might happen after the movie.
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
Ok, let's say all my previous script was only a "proof of concept". The double instance thing seem to be a failure to fully automate the process since it share savestate and it's almost unmaintainable, but I like the new direction we're are getting now. By the fact that we're starting to get more and more confident with pcsxrr source code, thing should be a lot easier now. I can already say that next version is gonna be at least 300% faster(from the screenshot hash processing) and far less overhead on the lua side.
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
Feos and I did some debugging thought pcsxrr for getting a switchspu function on the fly. I did some test and it seem to work if you proceed that way:
Language: pseudo-code

at frame 2600 : make a savestate(using "spuPlugin#1.dll") call emu.switchspu("spuPlugin#2.dll") loadstate to frame 2600 call emu.frameadvance()
So yeah, still need a load savestate in order to get immediate result, but I think this is a pretty good result. @Aktan: I'll need to look exactly what's up with the loading screen a bit more before answering you. But, I just want you know that the "tolerable desync" is a required concept for now and as we keep testing different game, we might lower the value for those tolerable desync. Last point, I should probably start thinking on how to redesign the whole script efficiently(in order to make it easier to maintain the script) now that I don't have to bother with some basic issue FROM pcsxrr. edit: using only using SPU_freeze while switching plugin seem to make the sound working between TAS sound plugin to eternal and vice versa. We will need one more fix to make sure switching plugin doesn't force lua to exit directly his current script.
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
While patrolling the detect Script read the XML. Same for the the sync script. The other way around would have been to use socket, much easier. Shame on me.
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
Aktan wrote:
In your example, the save state for frame 2601 was where though? I think that matters. If it is 50 frames back, you need to get a save closer to frame 2601.
Usually that sync/desync pattern was on a loading screen. So when I saw your post talking about this issue on loading screen, I knew tolerable desync feature was something necessary. edit: At some point here an another crazy idea: We might need a "formula guideline" for checking the amount minor desync VS major desync in order to determinate what is the amount of tolerable frame desync in order to keep a right level of sanity for "sound memory" (using eternal plugin). Someone understand what I mean? :D Joke aside... I'll post some more progress soon.
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
Yeah I know, I could lower the value of the tolerable desync. For instance with the Azure Dream movie, I keep getting this: frame 2600 Hash ok frame 2601 Desync frame 2602 Hash ok frame 2603 Desync Almost always. And there so many loading screen, that make it even more problematic. As you know, if we load a savestate at every let's say 50 frame. In the end you get almost the same result as using the TAS sound plugin. You see what I mean? At some point, it's up the encoder to choose the right value for the tolerable desync.
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
feos wrote:
Having a single instance with spu switch will remove the need for sleep().
Yes, make one and only one script would be great. Ok, actually here's how the current workflow work for those who wonder. Part1 Part2(The app2 is the interesting part)
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
feos wrote:
And by going back I mean going 11 frames back during "suspending process", checking earlier frames states.
This is what I call "busy-wait". It wait for get the detection script to make a new savestate. I know that busy wait is usually bad, but if I use a normal wait function from lua, window will think the pcsxrr process is freezed. Also, if I use an another kind of busy-wait that doesn't process frame. PCSXRR will send prompt to kill the lua script. Also since I'm still pretty sure we should run the sync script in kkapture if we want to get real encode. What I suggest if that we get a new lua function that just call a sleep function from pcsxrr. If Nach is to busy to add this, I'll do it myself this weekend.
feos wrote:
Why won't they happen?
I'll draw something later...
Experienced Forum User
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
feos wrote:
Aktan reported that we were doing it wrong all the time. It appears we don't need to jump farther and farther back for each savestate creation. More than that, if the fix point is really close to desync point, it may be at all skipped by our too long jumps. Say, if it's only needed to load the state 5 frame back, we will never be able to fix it by going backwards.
I alway use the nearest checkpoint to fix the desync at the exact frame. The script "never jump farther and farther" back. If that happen, this means that something seriously wrong happen.
feos wrote:
3.1. Load slot 1 in eternalSPU instance and verify hashes. If it fixes the picture, emulate ahead (step 6), otherwise do: 3.2. Load state 2, verify. 3.3. Load state 3, verify. ............ Repeat for each available slot. 4. If even state at slot 10 (frame 995) doesn't fix it, use it for rollback frame and create a few more states: 4.1. Save frame 996 to slot 1. 4.2. Save frame 997 to slot 2. 4.3. Save frame 998 to slot 3. 4.4. Save frame 999 to slot 4. 5. Load each of these states and verify. It MUST be fixed. 6. Proceed to the next desync.
Sadly, step 3.2 to step 5 are useless... they will never happen. Despite you want to load me to load savestate from a irrevalent "previous desync". Although, I believe that pcsxrr have some serious problem by the fact I alway use the slot 1 to do my stuff and pcsxrr might get confused because of that. If there 2 instance want to load/save at the same slot at the same time, this is where thing can start to go wrong. So yeah, I'll probably just add somes rules for using different slot for each instance or try to use some smart way to cycle them. That said, it's very easy to get confuse on how thing work. I may have to produce some flowchart to describre what's going on.
1 2 3 4 5 6
22 23