Coder Social home page Coder Social logo

Comments (7)

Bekenn avatar Bekenn commented on July 25, 2024

I don't know the answer to this offhand; I'll need to spend some time investigating.

from wcdx.

MartyShepard avatar MartyShepard commented on July 25, 2024

That would be great if you would have a look. I've already looked myself to death and tried different things.
Could this be due to the VisualC ++ 3.1 compiler that was used at the time?

from wcdx.

Bekenn avatar Bekenn commented on July 25, 2024

I could imagine that this has something to do with sign-extending a char to an integer offset, but that's just speculation. I'll take a look when I have some free time; maybe this weekend, we'll see.

from wcdx.

Bekenn avatar Bekenn commented on July 25, 2024

Yup, it's sign-extending the char value. That means that values above 127 are treated as negative offsets into the font table, which explains what you're seeing. It's fixable, but there are a lot of locations to track down.

from wcdx.

MartyShepard avatar MartyShepard commented on July 25, 2024

I would like to fix it myself so that I can translate the Kilrathi Saga WC1. But now I don't know where to look for it in the code. Do you like to do that?

Kilrathi Saga WC2. I have not yet checked whether it is the same as with WC1.

regards

from wcdx.

Bekenn avatar Bekenn commented on July 25, 2024

I don't include my IDA databases in the wcdx repo because they contain complete program code for the executables that originally shipped as part of Kilrathi Saga, and those executables do not belong to me. That makes it a bit harder to collaborate on the disassembling and patching aspects of this project, but I can at least point you in the right direction. Wing1.exe has a function at virtual address 0x43AD4E (file offset 0x3A14E) that I have named DrawText, which takes a const char* argument:

void __stdcall DrawText(const char* text)

It references a static structure located at virtual address 0x62264C that I've named ActiveTextContext. That structure has this layout:

#pragma pack(1)
struct TextContext
{
    Viewport* viewport;
    int16_t x;
    int16_t y;
    void* font;	// font data loaded from a resource file
    uint8_t foregroundColor;
    uint8_t backgroundColor;
    const char* textFirst;
    const char* textLast;
    uint8_t alignment;          // specifies left, center, or right alignment
    void* fontSomething;	    // haven't figured this one out yet
	Viewport* anotherViewport;	// not sure what this is used for yet, either
    uint8_t somethingElse;      // not sure about this one, either
};

The text context determines where text will be drawn to the screen. The textFirst and textLast fields are used to compose a row of text; they point into the string passed into the DrawText function.

Hopefully that's enough to get you going in the right direction. At some point, I'll revisit this myself and see if I can get your translation working.

from wcdx.

MartyShepard avatar MartyShepard commented on July 25, 2024

Hi,
Many thanks . That’s a start. I'll take a look .. but it's still a little bit of new territory for me.

from wcdx.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.