|
GuyPerfect Catgirl Level: 68 Posts: 813/1096 EXP: 2665654 For next: 63146 Since: 07-23-07 Since last post: 1.7 years Last activity: 219 days |
|
| A bit of a departure from the regular ROM hacking, this one is an emulator hack!
As of Pokémon Diamond and Pearl on Nintendo DS, the games have ventured into the realm of 3D graphics, which makes maps somewhat difficult to construct. Fortunately, all of the Generation IV games have a camera mode built-in that will use a "2D" orhtographic projection that's great for maps (it's used inside buildings). A little Action Replay code and you can use that camera mode anywhere. The Generation V games, on the other hand, I'm not sure there's even code in the camera system to do it. But to make maps anyway, it's necessary to get the games into an orthographic projection in some form or another. What I wound up doing was just tweaking an emulator to always use a particular projection matrix. It's not fancy, but it gets the job done. In the DeSmuME source code, gfx3d.cpp, is the following function: static BOOL gfx3d_glLoadMatrix4x4(s32 v) This handles the assignment of transformation matrix values in the 3D subsystem. To set a matrix on DS, you first specify the matrix mode, then write 16 values (one at a time) to define the matrix. The values are sent in column-major order. For this function in particular, mode specifies the matrix mode (the projection matrix is mode 0 in DeSmuME), and ML4x4ind is the current write index within a 16-element array for storing the values. Thanks to this convenient organization, it's a simple matter to inject a custom projection matrix into the code. So we can replace that first line with this: static s32 fudge[16] = { DS matrix values are 20.12 fixed-point, two's complement. These particular values specify an orthographic projection such that the player character is of identical size and position as in the default perspective projection of the games. The result is a world view that works just dandy for maps:
This works for all four Generation V games: Black, White, Black 2 and White 2. |







Gimme a few minutes to set up a web server so I can get the file to you. Maybe you could attach it to a post in this thread or something.

