Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

Need help regarding reverse engineer a model file

Featured Replies

  • Author
3 hours ago, Bigchillghost said:

It's really difficult to read your comment due to the lack of necessary punctuations and I always seem to lost focus on what you're actually trying to express. So I'm serious about this:

 

So why did you wrote the entire normal buffer from offset 0x8050 instead of one per vertex element?

file.seekp(32848);
int count = 0;
for (const auto& normal : normals) {
    if (count >= 2848) {
        break; // Reached the limit
    }
    for (float component : normal) {
        char byte = static_cast<char>((component + 1.0f) * 127.0f); // Convert float to Byte range
        file.write(&byte, sizeof(char));
    }
    // #### file.seekp(0x15, ios::cur) is required here!!! 0x15 == 24 - 3 bytes for the written normal
    ++count;
}

And what's this "remainingBytes" for and why did you insert the AB 00 00 00 pattern repeatedly?

// Check if we need to move to the next pattern
int bytesInjected = count * 12;
int remainingBytes = 32848 - 20 - bytesInjected;
if (remainingBytes > 0) {
    file.seekp(bytesInjected, std::ios::cur);
    for (int i = 0; i < remainingBytes; ++i) {
        char patternByte = (i % 4 == 0) ? 0xAB : 0x00;
        file.write(&patternByte, sizeof(char));
    }
}

 

The "blue" are the normal plus the tangent, the leading zero bytes might be an unused vertex color channel.

 

Something like:

uint8_t aByte = 0;
file.read((char *)&aByte, 1);
float toFloat = (aByte / 255.0) * 2.0 - 1.0;

 

Not sure what you mean by that. You hard-coded the address and count but expected it to be generic?

hi bro how are u thanks for replying, I was just trying to implement custom normal injection into the game from an obj file. An attempt for injection biscally to change the mesh in game. I did that successfully but normals were very badly looking in game, so i tried to inject normals from obj file but doesn't seem to work very well, but now as u provided me the code piece i can work on it and let u know, thanks again

  • Replies 52
  • Views 8.6k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • Just some more info: the file is made up of various segments.  Each segment has a 16-byte header, which contains the size of the data in that segment, followed by that amount of data.  So the first se

  • This looks like the values to use for that example mesh:  

  • shak-otay
    shak-otay

    I made a tool for perm.bin 10 years ago on Xentax - sadly Wei's head crashes it. But hex2obj works:

Posted Images

  • Supporter
On 5/24/2024 at 11:20 AM, shak-otay said:

The normals might be compressed in the vertex block, 2 x DWORD, aabbccFF, 2x24= 48 bits?

@roocker666: well, seems I was right with my first assumption...

edit: so normals, not vertex colors.

edit2: Bigchillghost made it clear that it's 8 bit normal's components (last Friday)

Edited by shak-otay
@ added

  • 1 year later...
  • Localization

Can somebody help me with this? I'm almost sure I entered correct inputs but I get this when I click previewimage.thumb.png.d642a7ee5ffbf71242f344b0e0f1bddb.png

image.thumb.png.d3626cf5693b3eb1a0be1fc308da5a49.png

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.