79181325

Date: 2024-11-12 13:36:55
Score: 2.5
Natty:
Report link

If you need ROM maps in memory that you will access in different compilation units you can allocate the memory in the first unit:

extern const unsigned char BPG_Arial29x32[] = {
    // Font Info
    0x00,                   // Unknown #1
    0x00,                   // Unknown #2
...
}

In the other unit there are two options to declare in the headers:

extern const unsigned char* BPG_Arial29x32;

OR

extern const unsigned char BPG_Arial29x32[];

The second is always working, and the first let the software 'hang' if you use it in that way:

inline static map<const unsigned char*, const char*> fontSoftToString = {
    {BPG_Arial29x32, "BPG_Arial29x32"}
};

inline static map<string, const unsigned char*> stringToSoftFont = {
    {"BPG_Arial29x32", BPG_Arial29x32}
};

But it works if you use it as a function parameter:

declare: SetTextFontRom(const unsigned char* font)
use: SetTextFontRom(BPG_Arial29x32);

Why is this and why this is not 'compatible'?

Reasons:
  • RegEx Blacklisted phrase (0.5): Why is this
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (1):
Posted by: Sam