Posts for Warepire

Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
Unless you can reproduce the issue with a version of Hourglass-Resurrection where someone HASN'T done who knows what to the source code, I am not going to bother with this one.
Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
jlun2 wrote:
Try different memory domains. Based on several games I played, GBC games tend to place coord addresses on WRAM, System Bus, or both. I only know 1 game (Harry Potter) that uses both for coords, so I assume this likely will not be the case as well.
System Bus is what old emulators usually display with RAM Search, WRAM is a sub-domain of it. Look at a memory map for the GameBoy (Color) to know which region of RAM is where.
Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
First: Wrong topic. Second: That error message box is completely useless as it contains no information as to what went wrong due to language... Third: Where did you even find a non-English version!?
Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
Hourglass crashing is a known issue. Under the hood Hourglass is doing a lot of undefined things with Windows. Or it could be that your game is doing stuff to the Windows API that Hourglass cannot handle properly yet.
Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
First: Is it Hourglass or -Resurrection? Second: Have you tried playing it in read-only mode, making a save-state where you want to continue, and then change it to read+write at state-load?
Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
feos wrote:
For a properly implemented hourglass resurrection, should it be possible to run flashplayer.exe? It allows to pass the game as a command line parameter and uses legit keyboard keys and mouse, so in theory it should.
Yes, that should eventually work, what's missing is necessary hooking rather than the pending re-structure.
Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
The Incredible Machine 2 for Windows 95? That one has a pool cue item, which might be what you're thinking of?
Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
LeHulk wrote:
I didn't equip the Lucky Blade at all. Manipulating RNG provides me enough gems already, and the advantage of the Critical Sword is too good. The reason why I don't always crit enemies (even if I could) is because it's not always the fastest way. Depending on when the 16th frame happens (the crit frame), it may or may not be faster to kill an enemy with magic, which takes only 9 frames (1f first hit + 8f invincibility frames) for most enemies. So if the crit frame happens more than 9 frames after the enemy becomes vulnerable, then it's faster to defeat it with magic. That choice can be also influenced by how many gems you want to keep for the rest of the run. Tough decisions!
Thank you for the explanation! Looking forward to Leo's Laboratory.
Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
Great WIP once again. One question though: Did you ever switch to the lucky blade? It seemed like you stopped trying to one-hit kill everything after a while, but I can't find a change in blades.
Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
This was fantastic. Yes vote.
Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
Gamer Maiden Sonia wrote:
So, save states don't even work at all on a non XP OS? That would kill the whole point of using Hourglass for me since when I do my movies I pretty much only use save states and on some occasions slowdown or frame advance. But that's it. I don't really use any of the other emulation tools. I guess I will have to find a way to operate on XP then.
They do work on Win7 and Win8 (not sure about Win10), but they can crash the computer (not the game, not hourglass, the computer), the frequency depends on the game.
MUGG wrote:
Can't you just emulate XP in virtualbox and run hourglass in it? That's what I tried, but my games of interest don't seem to work with hourglass.
This is the best solution of the ones available.
Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
The idea isn't that bad, but it does come with it's own difficulties. The biggest one being that you need a complete (additional) Windows installation, and higher hardware requirements. Also going by the state of VirtualBox (the only, to my knowledge, open source VM), there is a lot to do in order to get it running stable enough to TAS with. I base this of VirtualBox not being particularly stable for regular usage today. VMware is much more stable, but not open source.
Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
danylopez123 wrote:
WHAT!? No really! I have those problems! How you got them to work? What settings or what bios you are having?
Make sure to use BIOS images recognized in the firmware window, and that you have a BIOS for each region you try to play a game from (NTSC-U BIOS for US games, PAL BIOS for EU games etc). Thanks to accuracy there is no settings to configure other than making sure to have good disc images and good BIOS images. Make sure every disc is a img/bin with a cue/ccd, and maybe an optional sub (if it's an img image)
Post subject: Re: PSX Multi-Disc support with recording + no-working PSX games
Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
danylopez123 wrote:
I'm new to the forums, so pls, dont go bad with me See, i was making a PSX recording from Driver 2 (S) but after i reached the end of Disc 1, tells me to insert disc 2 and i cant do it individually, when i launch the disc 2, shows the intro and stuff, but then, it will tell me to insert disc 1, wich i am on a dead end I dont know how i can explain it better, im spanish
This is a bit of hidden information, but create a text file containing the filenames for the .cue / .ccd files and name it as an m3u. Then open that in Bizhawk. Example multidisc.m3u:
a_game_disc1.cue
a_game_disc2.cue
Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
Dwedit wrote:
What about an infinite loop at the entry point and CreateRemoteThread?
ntdll.dll and kernel32.dll must have loaded and executed their DllMain's before LoadLibrary can be executed. Also CreateRemoteThread that instantiates any form of DLL loading is detected by most anti-virus programs as malware. Double no-go. You might be interested in joining #hourglass, it will be easier to answer your questions that way.
Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
Dwedit wrote:
What about the alternate loading modes of LoadLibrary, such as DONT_RESOLVE_DLL_REFERENCES for LoadLibraryEx?
The main issue is that neither API call can load the DLL in another process before that process executes code. My method does that.
Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
Octoshock is a PS1 emulator, not a PS2 emulator.
Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
Nach wrote:
I'm kind of surprised by some of the things you tried that wouldn't work. Due to relative addressing and virtual memory management, nothing other than properly parsing and offsetting memory references in the correct application's address space is going to work. I'm glad you got it figured out in the end! So, what's next on the agenda?
The reason the failed methods failed aren't so surprising to me now that I understand more of how Windows handles the DLL when it's being loaded. The next step is to design and implement an IPC so that the DLL can communicate with Hourglass, regardless of what is loaded. I have a pretty good idea already what to do here. Then it's time to migrate and re-structure the logic so that this method can be used officially.
Dwedit wrote:
So besides sticking the loadable sections from the DLL into process memory, and applying the fixes from the RELOC section, and calling the entry point, what else is there to do to manually load a DLL?
Registering the DLL with Windows so Windows knows it exists etc. This is most likely not really doable without running the actual LoadLibrary call. But for the purpose of Hourglass neither calling the entry point or registering the DLL with Windows is necessary.
MUGG wrote:
Good job! That sounds like some deep stuff indeed. But I can't really understand it, since I know next to nothing about what you had to deal with. I'm more curious what this progress is worth. Forgive me if my questions are going to be misplaced, but I'm curious. How close to done is the Hourglass-Resurrection project and will it be able to deal with higher level games? E.g. Might and Magic 8, Rollercoaster Tycoon, Anno 1602, Age of Empires Or will it stay at "simple game" level?
The project is about as close to done as it was when it started, due to the insane amount of work remaining. Half-Life is already kinda bootable, so is Red Faction, but the games are not playable as it is today. Goal is for everything to work, but as it stands today, that goal is FAR from realized,
WST wrote:
Dwedit wrote:
So besides sticking the loadable sections from the DLL into process memory, and applying the fixes from the RELOC section, and calling the entry point, what else is there to do to manually load a DLL?
Your avatar is very cute.
Thank you WST for adding value to this thread.
Post subject: Revisiting the hooking procedures
Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
... Or: How Hourglass can use the Windows debugger API to do better. This write-up is going to get technical, there's no way around it, and no way for me write a tl;dr. You have been warned. After a lot of problems with how Hourglass hooked into the WinAPI that I encountered when I tried to implement memory management, and several discussions on IRC etc, it was decided that the current hooking method was never going to work good enough. It was simply, too slow, several DLLs had completed their DllMain()'s before hooking even began, and this cause more and more headaches. Heaps were set up etc already before it could be managed. The previous method of IAT patching was just not going to cut it anymore, so, a new method had to be found. After bouncing ideas with Nach and the #midipix IRC channel, among others, I was inspired to craft the solution presented here. I am truly sorry but I forgot who else inspired me for this solution, so yell at me about it so I know! Credits are deserved where credits are due. I was given some other potential solutions as well, which I need to point out, including Kernel level APCs (Async Procedure Calls). I found the chosen solution to be sufficient for my problem as it stands today. The solution I went with is to behave more like a real debugger does, and depend more on debug events than before. Almost all the information needed are given in the debug events, and given much earlier than any injected DLL can even begin to execute. This is where I put my focus, how can I inject a DLL as early as the process space setup (which is before code executes)? There's this handy debug event for this that triggers when the process has just been created, and it also freezes the process at just the right moment by itself (being a debug event and all). There's a similar event for each DLL the process pulls in. The missing information? Well, that's where in my own DLL the code is that I want the hooks to execute, the linker can help me with that part. I just had to tell it to generate map-files, which I then can parse, and know exactly what parts in my DLL I need to patch or refer to. Here I started looking at "How do I get my DLL into the remote process space when I can't load it using an API call?" as there is no way to load a DLL into a process that hasn't executed a single instruction of it's code. Not with the APIs at least... Enter the failed attempts: > Load the DLL as a file and just write it in the process space. --- This does not work, the DLL does not have the same structure in memory as it has as a file. Caused a lot of headaches with memory access violations and pointers not pointing at anything sane in memory. > Load the DLL into my own process and copy it to the process space. --- This does not work, the DLL does not handle this if the address in the remote memory is different from the local memory. Also came with a lot of issues regarding the copying itself, which usually never actually took place leaving me with uninitialized memory instead of a DLL to execute. What I needed was my own way of loading a DLL as the API call LoadLibrary loads it (except for the execution of DllMain()). This sent me on a very interesting adventure among PE and COFF specifications. These specifications define the layout of executable files for Windows. In order to load the DLL correctly, I had to learn how to parse these things. And that I did. I apologize in advance for the not very exciting picture (click to zoom): Here we see Hourglass running my little demo program that does nothing except create a window. In the background is where the exciting stuff is going on as that is the call stacks and debug messages exported by Hourglass when it's captured by Visual Studio. Pay attention at the top of the log where it says "MyCreateWindowExW: Hello from the hook!", this is not part of the demo program, but the hook I attached to the API call that creates the window, CreateWindowExW. I also need to specifically thank ais523 and Masterjun who gave me invaluable help when I broke the assembly patching of API calls: THANK YOU! Code is here for those who want to admire it, or be completely horrified by it: https://github.com/Warepire/Hourglass-Resurrection/tree/new_hooking_poc
Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
For starters, everyone can use their favorite IRC client to connect, no need for special apps and crap.
Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
The biggest problem right now is that save-states aren't re-useable between sessions, meaning that once Hourglass is shut down, the save-states are just junk. The only gain is that Hourglass uses less RAM. This is however a planned improvement for the future, when save-states hopefully have been made cross-session. Making save-states cross-session is not a small task.
Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
Use a bin/cue or img/cue or ccd/img combination. Not iso. Load the cue/ccd file as the disc.
Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
Unfair difficulty.
Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
It keeps getting better, the Critical Sword is ridiculously over-powered. Fantastic WIP.
Warepire
He/Him
Editor, Experienced Forum User
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
Well done, yes vote.