SonLVL

Discussion in 'Utilities' started by MainMemory, Mar 29, 2011.

  1. Novedicus

    Novedicus Well-Known Member Member

    Joined:
    Aug 26, 2013
    Messages:
    857
    Is it possible to include DPLC data (in ASM format) in an XML file? I attempted to use dplcfile, but it just results in an error describing that there's an invalid index in a source array.
     
  2. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    832
    The DPLC file must be in the same format as the mappings file.
     
  3. Novedicus

    Novedicus Well-Known Member Member

    Joined:
    Aug 26, 2013
    Messages:
    857
    Both the mappings and DPLCs are in ASM format.
     
  4. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    832
    I'm not sure what the problem would be then, other than a bug in the parser, an invalid frame number, or if you're using S3K mappings with S2-style DPLCs.
     
  5. Novedicus

    Novedicus Well-Known Member Member

    Joined:
    Aug 26, 2013
    Messages:
    857
    What do you exactly mean by that? Aren't S2 and S3K DPLCs the same format or are you referring to how the S2 disassembly uses binary mappings?
     
  6. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    832
    No, S3K has two types of DPLCs, the ones used by the player characters (and possibly something else) which are identical to the format used by Sonic 2, and ones used by other objects which use a brand new format. SonLVL defaults to the object format in S3K, you need to specify dplcver="S2" to use the player format.

    If you're wondering what the differences are, S2 has a range of 0-65535 entries per frame, while S3K has a range of 1-65536 entries per frame, and S2's entries have the tile count in the first four bits, while S3K's have the count last.
     
  7. Novedicus

    Novedicus Well-Known Member Member

    Joined:
    Aug 26, 2013
    Messages:
    857
    And that fixed it for the XML file, so, thank you!

    However, one more problem. I did the same for the INI file since certain objects would not show up, and out of the three I defined, only one actually worked. The others just spit out the same error as before.

    Code:
    System.ArgumentException: Source array was not long enough. Check srcIndex and length, and the array's lower bounds.
       at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
       at SonicRetro.SonLVL.API.LevelData.ProcessDPLC(Byte[] artfile, DPLCFrame dplc) in C:\Users\Devon Artmeier\Documents\SonLVL-Owari\SonLVLAPI\LevelData.cs:line 2082
       at SonicRetro.SonLVL.API.LevelData.MapFrameToBmp(Byte[] art, MappingsFrame map, DPLCFrame dplc, Int32 startpal, Boolean priority) in C:\Users\Devon Artmeier\Documents\SonLVL-Owari\SonLVLAPI\LevelData.cs:line 2095
       at SonicRetro.SonLVL.API.ObjectHelper.MapDPLCToBmp(Byte[] artfile, Byte[] mapfile, EngineVersion mapversion, Byte[] dplc, EngineVersion dplcversion, Int32 frame, Int32 startpal, Boolean priority) in C:\Users\Devon Artmeier\Documents\SonLVL-Owari\SonLVLAPI\ObjectHelper.cs:line 36
       at SonicRetro.SonLVL.API.ObjectHelper.MapASMDPLCToBmp(Byte[] artfile, String mapfileloc, EngineVersion mapversion, String dplcloc, EngineVersion dplcversion, Int32 frame, Int32 startpal, Boolean priority) in C:\Users\Devon Artmeier\Documents\SonLVL-Owari\SonLVLAPI\ObjectHelper.cs:line 70
       at SonicRetro.SonLVL.API.DefaultObjectDefinition.Init(ObjectData data) in C:\Users\Devon Artmeier\Documents\SonLVL-Owari\SonLVLAPI\ObjectDefinition.cs:line 530
    My DPLCs looks like this:
    Code:
    ; --------------------------------------------------------------------------------
    ; Dynamic Pattern Loading Cues - output from SonMapEd - Sonic 3 & Knuckles format
    ; --------------------------------------------------------------------------------
    
    SME_4L7nY:  
            dc.w SME_4L7nY_2-SME_4L7nY  
    SME_4L7nY_2:    dc.b 0, 1, $F0, 0  
            even
     
    Last edited: Nov 8, 2018
  8. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    832
    Well assuming you've set that to S2, the only other thing it could be is that there aren't enough tiles in the art file to cover the range used by the DPLC.
     
  9. Novedicus

    Novedicus Well-Known Member Member

    Joined:
    Aug 26, 2013
    Messages:
    857
    Yeah, it turned out my DPLCs were shite. Thanks SonMapEd!
     
  10. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    832
    So thanks to @Samey, the project files for the S1 2005 disassembly have been updated and are not only fully compatible with the current version of SonLVL, but they've been updated so they have all the same information as the GitHub disassembly's project files.