1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#pragma once
#include <stdio.h>
#include <assert.h>
#include <stdint.h>
static inline void
xi2path(char out[12], const uint16_t id)
{
snprintf(out, 12, "%u/%u.DAT", (uint8_t)(id >> 7), (uint16_t)(id & 0x7F));
}
static inline void
xi2rompath(char out[18], const uint8_t rom, const uint16_t id)
{
assert(rom <= 9);
char path[12];
xi2path(path, id);
if (rom > 1) {
snprintf(out, 18, "ROM%u/%s", rom, path);
} else {
snprintf(out, 18, "ROM/%s", path);
}
}
|