don't click here

SADX/SA1 Hacking/Modding

Discussion in 'Engineering & Reverse Engineering' started by MainMemory, Aug 15, 2009.

  1. Turbohog

    Turbohog

    Member
    937
    119
    43
    Ah, okay. That's weird that only some textures have versions for the other languages. Any idea about the sound test thing? It seems inconsistent. Not sure why, but I saw it working correctly a couple of minutes ago. Now it's not working correctly again.
     
  2. Turbohog

    Turbohog

    Member
    937
    119
    43
    Double post because I did a thing.

    https://mega.nz/#!qkU1FKQb!tyEd_ayKPPykGvQbOvUn_QE8lw0uyJkZ18pG8GsfxEM

    This is just a small texture mod. I turned on SADX pc a week and played with my xbox 360 controller. I was bugged by all of the references to the keyboard. This replaces any textures that include keyboard stuff (like Press Enter, etc.) with xbox 360 equivalents. The only thing this does not replace is the gamegear menu textures. Also, I think the chao race textures may be messed up.

    On another note, I also added a batch import option to PVMEditSharp. I did this so I could easily replace all of the textures in some of the PVMs to the textures from the equivalent GVMs (from the gamecube release). Using this method, I replaced all of the gamegear menu textures to the textures that were on the gamecube release. It worked, but the textures weren't lined up quite right in the menus as a result.

    Eventually I will probably edit the gamegear textures to also reference the 360 controller instead of the keyboard.

    Edit: For the curious, I just grabbed the corresponding pvm's from the XBLA release. This could be done with the PS3 version as well, if you wanted to see that controller in the game. I don't have that version though, so I can't do that unless someone gave me the files.
     
  3. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,758
    341
    63
    SonLVL
    It's probably a better idea to use texture packs when taking textures from the GC version to prevent quality loss in the GVR->PVR conversion.
     
  4. Turbohog

    Turbohog

    Member
    937
    119
    43
    I did notice that some quality was lost, but it was more of a little experiment more than anything. Eventually I'll just edit the gamegear menu textures and add xbox 360 contoller stuff in. Not sure if I'll need to use texture packs for that or not. What are the limitations for the PVMs?
     
  5. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,758
    341
    63
    SonLVL
    PVR textures (such as the ones in PVM files) can only use a specific set of color depths: RGB565 (five bits red, six bits green, five bits blue), ARGB 1555 (pixels are fully transparent of fully opaque), or ARGB 4444 (each channel gets 16 levels). GVR textures have many more formats, some of which are higher quality than the PVR ones. PNG files, of course, can assign 8 bits for every channel, which is enough to cover everything PVR or GVR can store.

    I'm not entirely sure, but there may also be a pixel size limit on PVR textures in SADX. But that's hardly relevant to what you're doing.
     
  6. Turbohog

    Turbohog

    Member
    937
    119
    43
    Thanks for the detailed explanation; I couldn't find anything like that elsewhere.

    I haven't had time to work on that simple texture pack lately and it will be a few months before I get a chance to make some custom textures for the game gear menus.
     
  7. evilhamwizard

    evilhamwizard

    Researcher
    1,393
    468
    63
    Ack, I need some help with PVM files and textures.

    I'm working on restoring the textures to Windy Valley in the AutoDemo but the stage/object texture files I was given were too big for VRAM. I want to make them smaller without seriously compromising on quality.

    I found a copy of pvrconv.exe from the SDK that lets you create .pvr files from .bmp/.tga files. Using pvrconv gives me a better file size in comparison to ripping the .pvr files that are stored in the original .PVMs. But when I go to create a brand new .PVM archive with PVM Editor, the file size of the output PVM is practically unchanged vs the original PVM. For comparisons sake, all the .pvr files originally amounted to around 1.3mb for the texture file I have for the first act, which is also around the same size of the .PVM that they are in. After creating new .pvr files using pvrconv, the generated .pvr files amount to around 400kb. These .pvr files can be added in PVM Editor, viewed in PVR Viewer, Puyo Tools, etc. However, adding the pvrs with PVM Editor to a new PVM file creates a PVM file equal to the size of the original PVR files (1.3mb). I have no idea what's going on...

    I tried building the PVM archive with the pvr files generated with pvrconv with Puyo Tools, and while the generated .PVM file is the size that I expected, it fails to load in game or in any editor.

    I'm not sure what to do besides maybe decrease the quality of the textures themselves, but it doesn't seem to improve the file size by that much...
     
  8. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,758
    341
    63
    SonLVL
    If you're referring to PVMEditSharp from SA Tools, it automatically converts PVR files to bitmaps on import, and converts back to PVR when saving, using the "Rectangle", "SquareTwiddled", or "SquareTwiddledMipmaps" data formats, with no compression. It's possible that one of the other data formats uses less space to store textures or pvrconv enables RLE compression.
     
  9. evilhamwizard

    evilhamwizard

    Researcher
    1,393
    468
    63
    Hmm, could be. I ended up tracking down a copy of PVMconv.exe from the SDK and was able to build a working PVM file with the converted PVR files. I went from a 1.3mb PVM file to a 400kb PVM file, compressed to a 300kb or so PRS file. I guess the PVM file would work in SADX as well, so it's a nice tool to use if you wanna find a way to use less memory while retaining some texture quality.
     
  10. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,758
    341
    63
    SonLVL
    I'd like to know what settings those textures are using.
     
  11. evilhamwizard

    evilhamwizard

    Researcher
    1,393
    468
    63
    The originals I were given were all Square Twiddled. With pvrconv I used VQ algorithm 3 (the old PVR Viewer considers these "VQ + Mipmap" for some reason, so mipmaps must be a default for pvrconv?) on a lot of them and square twiddled on the smaller sized ones. There's a slight hit with texture quality using VQ algorithm 3, but it's not that bad.
     
  12. PkR

    PkR

    Member
    191
    24
    18
    SADX Dreamcast Conversion, The Emeralds' Awakening
    Hello, I'm trying to compile my first mod for SADXModLoader and I need some help...

    1. When I open Chaos 0 in SADXLVL2, it loads without textures. When I try to edit material properties, it gives me the following message: "Exception has been thrown by the target of an invocation". Is there a way to edit materials on this level?
    2. Trying to load Station Square 1 in SADXLVL2 causes the program to crash with the following message:
    3. I assume I need to use StructConverter for stuff inside sonic.exe and DLLModGenerator for everything else. Is this correct?
    4. When I export Station Square 2 (or 3) landtable using DLLModGenerator and include the .cpp file in my mod, it compiles successfully in Visual Studio. However, when I try to use the mod, the game crashes as soon as I enter the modified area. What am I doing wrong? It also crashes when trying to inject an unmodified landtable, however it seems to work fine with Action Stages.

    Thanks a lot in advance!
     
  13. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,758
    341
    63
    SonLVL
    This one was my fault, I forgot to specify the texture file for Chaos 0, since it can't be auto-detected, due to the texture list being in a DLL. I've updated SA Tools to fix it.
    There appears to be an invalid object in one of the SET files for that level. I'm not really sure how to handle that.
    "Everything else" being anything that came from a DLL file, yes.
    The problem you're running into here is probably with the texture list pointer in the LandTable structure. SA Tools merely stores it as an integer value, rather than trying to pull in the entire texture list into the sa1lvl file. The file, and thus the code you generated, refers to the original location of the texture list in the DLL file as a raw number. However, that number is based on the DLL file being loaded in RAM at 0x10000000, which it won't be, because the mod loader or CHRMODELS.DLL will be there first. So the game grabs a pointer to data that isn't a texture list and promptly crashes.

    There are two possible ways to fix this: you could make an NJS_TEXLIST structure inside your code to hold the texture data for the level, and rewrite the code in sonic.exe that updates the PVM lists to use your new list instead; or you could use an Init function in your mod to grab the proper address of the texture list from the DLL and edit the value stored in the LandTable structure. I'd go for the latter, although getting the address requires some inside knowledge of the structure of the DLL (such as from the disassembly).
     
  14. Blue Spikeball

    Blue Spikeball

    Member
    2,410
    1,010
    93
    Hey guys. I've been trying to fix some details that bugged me. First, the Chao Naming Machine is mislabeled as Chao Adventure in the 2004 version. This was corrected in the Steam version. So I swapped the texture with the updated one; you can find the edited PVM here.


    I'm going to need some help with the next one. I'm also trying to fix Final Egg's exterior in Mystic Ruins. They really messed up its look in the porting process. The renderings of its inner cylinder's textures look pretty awful and glitchy in this version:
    http://imgur.com/a/bo15u

    The GC and DC versions had it right. Here are screens of the GC version for comparison:
    http://imgur.com/a/bo5t2

    Part of the problem seems to be that it uses an incorrect texture. The textures are contained in MR_FINALEGG.PVM. The cylinder's texture is mrd_064s_efd, but the model in the PC version uses mrd_128s_efhikari instead, which belongs to the lights on the tower and the borders of Final Egg. Another problem is that it renders the parts of the image with alpha channel set to 0 as black, while any pixels in which it's higher than 0 are treated as being fully transparent. Completely backwards :psyduck:
    Simply replacing the textures in the PVM file wouldn't be enough due to the alpha channel issues, plus it would break the parts of the model that use the lights texture.
    Another thing is that the tower's outer layer with the lights seems to be missing, but as you can see by looking at its borders in these pics, the mesh is still in the PC version; it's just invisible. It becomes "visible" when there are lightbeams behind it. It also becomes semi-visible when you look at the tower from far away, such as from where the minecart to the main MR area is, but get as close as the Lost World temple and it disappears.
    Any ideas on how to fix it this mess? Material editing? Model editing? GC model porting? Holding the Sega devs at gunpoint and demanding that they patch it? :argh:


    Yet another problem is that the lights on the "ring" surrounding Final Egg have black squares behind them in the PC version. The console versions don't have this problem. This one is much easier to fix; all it takes is editing the texture's alpha channel. I took the liberty of doing it; you can download the fixed PVM here. Here are comparison pics:
    [​IMG]
    [​IMG]
    [​IMG]
    Too bad that the tower still looks like ass.


    Lastly, it would be nice to correct this infamous cutscene. Anyone has any idea how to change the voice clip used in that cutscene? The SCHG for SADX isn't very helpful in this area.


    PS: Morph, if you're reading this, feel free to add any of my little "fixes" to SADX:FE. Or don't, your call :v:


    Edit:

    I figured out a little workaround for adding the lights back to the tower. I simply edited the tower wall's texture, pasting the lights over it:
    [​IMG]
    It's a hacky solution, but it's better than nothing. Here's the edited PVM file. Will try to come up with something better later. Still haven't figured out what to do about the inner cylinder, though.
     
  15. SF94

    SF94

    Tech Member
    The light around the tower being invisible could be a number of things. If it's using the wrong texture all together, simply editing its materials would fix it.

    If it doesn't though, what's probably happening is the transparent model (the one with the lights) is being rendered before the opaque model, and the opaque model is overwriting it in the framebuffer. This isn't an issue they had to deal with on the Dreamcast since it has order-independent transparency as a hardware feature, but it's an issue on basically every other platform this game is on.

    What could also be happening, going by some of those screenshots, is that the faces are flipped. You could try applying the double-sided flag to the materials, but I don't think the game actually respects that material flag in any capacity.

    also re: black pixels on transparent textures:

    That's a side effect of them being like: yeah sure, converting from one lossy format to another lossy format and then back to the original lossy format for the PC version will be fine and most certainly won't degrade texture quality nope not at all.
    tl;dr most of the transparent masks are garbage because sega is dumb
     
  16. Blue Spikeball

    Blue Spikeball

    Member
    2,410
    1,010
    93
    Thanks for the advice. Unfortunately, it seems that material editing with SADXLV2 isn't an option after all, as it's an object rather than part of the scenery. I'm guessing that the only option would be manually editing the model?

    Anyway, I just updated my Final Egg fix. The tower lights are smaller now, like in the console versions. I also added back the missing lights on the helipad towers' walls. Get it here.

    Comparison pics:
    [​IMG]
    [​IMG]
    [​IMG]
     
  17. PkR

    PkR

    Member
    191
    24
    18
    SADX Dreamcast Conversion, The Emeralds' Awakening
    This is something I'm planning to tackle in my Dreamcast conversion, so I decided to chime in and share my thoughts and suggestions. First, I found this object's model in the Dreamcast version and compared it against the SADX PC version, and they look pretty much identical. You can view both models in SAMDL. The SADX model is in ADV02MODELS\___ADV02_ACTIONS\0.sa1mdl (in the data produced by split_ADV02MODELS). The SA1 model is in ADV02.BIN, address 20C3B0 (SA1 format).

    However, when looking at the model in code I found a few things that seemed off. First of all, some materials had diffuse color set to 0xFF020000, and some were 0xFFFFFFFF, which looked kinda odd. So out of curiosity I replaced those with the standard 0xFFB2B2B2 and voila, the lights on the tower and the inner cylinder are back: [​IMG]

    This is only a partial fix, though. There are still a few broken things about this model, for example the light beams and the glow around the tower seem to render behind the skybox sometimes. These issues are most likely caused by transparency sorting shenanigans Morph mentioned above. It might be possible to get this model to render properly in SADX by editing its object hierarchy to make sure the transparent bits are rendered last. I'm about to see whether I can get this fixed.

    Anyway, in the meantime here's an early version of the fix that I quickly put together for you. It uses the Dreamcast model with fixed diffuse colors, and it also includes a texture pack with textures from the Dreamcast version, which are the highest in quality among all versions of SA1/SADX. You might want to apply your alpha channel fixes to those as well because I think the alpha channels problem will persist even in the fixed model - this is just the way SADX handles transparency. I've run into this several times previously while porting objects and levels from the Dreamcast version.
     
  18. Blue Spikeball

    Blue Spikeball

    Member
    2,410
    1,010
    93
    Damn you, shamelessly surpassing my fix :argh:

    Kidding. Many thanks for your efforts, that looks fantastic! :specialed:

    Here's the Dreamcast lights texture with the alpha channel fix. Feel free to use it. I also cropped the Eggman logo texture in half to prevent the double logo issue, as the texture map in that part of the PC version's model uses one half and mirrors it.

    One thing of note: The spinning cylinder suffers from that transparency issue as well, in relation with the lights texture:
    http://imgur.com/a/NcM62
    When you correct the mesh order, you'll want to fix that too.

    Interesting that the cylinder was using the right texture after all; the "holes" in it were caused by the invisible mesh with the lights texture around it overlapping it.
     
  19. PkR

    PkR

    Member
    191
    24
    18
    SADX Dreamcast Conversion, The Emeralds' Awakening
    Oh, my bad.?Actually I mirrored the Dreamcast textures because I had originally intended to work with the DX model but then I forgot about them after I imported the Dreamcast model. The original Dreamcast textures are the same as your fixed textures. I'm halfway through with the model fix so I'll update the textures when I'm done with it. Anyway thanks for the heads up.
    That is actually a texture on the outer cylinder. The reason it looks like that is because the transparent mesh in the outer cylinder gets screwed up due to transparency sorting, so parts of the texture containing the alpha channel are behind the inner cylinder.

    EDIT: Okay, here is the fixed version. Re-sorted Dreamcast model + Dreamcast textures + your alpha channel edit. It looks like this:
    [​IMG]
    It's not 100% perfect because there are transparent things behind other transparent things, and it becomes more complicated as more layers of transparency are added, so if you get really close to it (not during normal gameplay) you might notice some things looking slightly off around the top of the tower. On the whole I think it's a lot closer to what it's supposed to look like, though :P
    Also, the black outline around the light beams is most likely fixable with an alpha channel edit. The same way you can make the glow around the tower more prominent, which you might consider doing because it looks more vibrant in the console versions. I'll make my own version of it when I get to Mystic Ruins in my Dreamcast project.
     
  20. Blue Spikeball

    Blue Spikeball

    Member
    2,410
    1,010
    93
    Whoops, got confused. Meant it the other way around from what I said :psyduck:
    My bad, though you still got it.

    Yeah, that's what I'm talking about. The mesh around the tower overlapped the rotating cylinder.

    You did good :)

    You missed a little case, though. The sprites on the top of the tower are still being overlapped by the lights:
    http://imgur.com/a/qlMXj

    The bridge to Final Egg is also still overlapped by the light beams when they're in front of it, but they're both rendered correctly when the bridge is in front.

    Good catch. It's probably worth a shot. Do you know what's the beams' texture? Because I'm pretty sure it's not in MR_FINALEGG.PVM.



    On an unrelated note, does anyone know if we learned more about Missions since the last time the wiki's SCHG was updated? I've been toying around with the idea of porting the Dreamcast version's DLC challenges to SADXPC as missions.