Post subject: Lock on Tails
Player (37)
Joined: 9/9/2006
Posts: 388
Is it possible that Nitsuja still has his camera-lock hack that allowed him to keep Tails on-screen for Sonic3/3k/k. If so, is it possible / difficult to modify it to work for sonic 2?
A whisper in the wind~~
Post subject: Re: Lock on Tails
Emulator Coder, Skilled player (1310)
Joined: 12/21/2004
Posts: 2687
Gens already has the code in it to keep the camera on Sonic in Sonic 2, it's disabled but you can enable it by uncommenting the following lines in hackdefs.h
#define SONICCAMHACK // enables camhack (see Sonic offscreen) in sonic games, and hitbox/solidity display
#define S2 // specifies that the sonic game being used is Sonic 2-based
and you might want to enable these too if you want it to look otherwise normal besides the camera position:
#define SONICNOHITBOXES // disables hitbox display of SONICCAMHACK
#define SONICNOSOLIDITYDISPLAY // disables solidity display of SONICCAMHACK
Then since you want to look at Tails instead of Sonic, there's a line in SonicHackSuite.cpp you can change:
#elif defined S2
	const unsigned int P1OFFSET = 0xFFB000;
I believe Tails is at 0xFFB040 instead of 0xFFB000. It should also be easy to change it into something non-constant if you want to be able to switch back and forth. For a really quick example that I think would work but isn't necessarily the best way to do it:
#elif defined S2
	//const unsigned int P1OFFSET = 0xFFB000; // <-- disabled
	// Focus on Tails if caps lock is on, or Sonic if caps lock is off
	#define P1OFFSET (GetKeyState(VK_CAPITAL) ? 0xFFB040 : 0xFFB000)
Post subject: Re: Lock on Tails
upthorn
He/Him
Emulator Coder, Active player (391)
Joined: 3/24/2006
Posts: 1802
nitsuja wrote:
Then since you want to look at Tails instead of Sonic, there's a line in SonicHackSuite.cpp you can change:
#elif defined S2
	const unsigned int P1OFFSET = 0xFFB000;
I believe Tails is at 0xFFB040 instead of 0xFFB000. It should also be easy to change it into something non-constant if you want to be able to switch back and forth. For a really quick example that I think would work but isn't necessarily the best way to do it:
#elif defined S2
	//const unsigned int P1OFFSET = 0xFFB000; // <-- disabled
	// Focus on Tails if caps lock is on, or Sonic if caps lock is off
	#define P1OFFSET (GetKeyState(VK_CAPITAL) ? 0xFFB040 : 0xFFB000)
Actually, the code he'd be compiling that from already has the ability to change camera focus through the object table just by using page-up and page-down (also "home" to reset on sonic). The reason I hadn't replied to this yet is because I assume he wants one pre-compiled, and I've been too busy lately to compile a version from gens_11a and upload it somewhere public for him.
How fleeting are all human passions compared with the massive continuity of ducks.
Player (37)
Joined: 9/9/2006
Posts: 388
This works fairly ok. This may be going a step far but. The "speedhack". Any chance you guys have the addresses to those to? It'd be helpful if I could toggle between Sonic and Tails and still know their speeds etc. Oh - one small thing. The Camhack goes a bit weird when switched to Tails, Hitboxes and stuff doesn't always show correctly. And a small Q - Any chance it could center the camera on Tails?
A whisper in the wind~~
upthorn
He/Him
Emulator Coder, Active player (391)
Joined: 3/24/2006
Posts: 1802
DDRKhat wrote:
This works fairly ok. This may be going a step far but. The "speedhack". Any chance you guys have the addresses to those to? It'd be helpful if I could toggle between Sonic and Tails and still know their speeds etc. Oh - one small thing. The Camhack goes a bit weird when switched to Tails, Hitboxes and stuff doesn't always show correctly. And a small Q - Any chance it could center the camera on Tails?
If you use numlock, you can see the base address in RAM of the object you are currently focused on (add FF to the front to use it in ram search). I believe I set the speedometer to cycle with the camera focus, so if you see something in ram search with the same value as the speedometer shows, that'll get you the address. And it does center the camera on the focused object, but the object will make one frame's worth of movement between the focus coordinates being set and the frame being rendered, which may result in sonic/tails/whatever being slightly off center in camhack if they are moving at high speeds. ... And it only triggers if the object goes offscreen from normal focus. ... Also it doesn't trigger if scroll lock is on.
How fleeting are all human passions compared with the massive continuity of ducks.
Player (37)
Joined: 9/9/2006
Posts: 388
upthorn wrote:
If you use numlock, you can see the base address in RAM of the object you are currently focused on (add FF to the front to use it in ram search). I believe I set the speedometer to cycle with the camera focus, so if you see something in ram search with the same value as the speedometer shows, that'll get you the address.
Regardless of switching between Sonic / Tails . I always see Sonic's speed. So wouldn't searching the Speedometer value simply show me Sonic's speed? How would I determine Tails' from this?
upthorn wrote:
And it only triggers if the object goes offscreen from normal focus
Which is what I meant. Anyway to force it constantly, long as their in a game level?
A whisper in the wind~~