mirror of https://github.com/nmlgc/ReC98.git
[Decompilation] Add a separate segment type
At least wherever Turbo C++ and master.lib want us to use a non-pointer, since both use uint16_t for segment values throughout their APIs instead of the more sensible void __seg*. Maybe, integer arithmetic on segment values was widely considered more important than dereferencing?
This commit is contained in:
parent
59bbe313ad
commit
417ba80c00
|
@ -23,3 +23,9 @@ typedef unsigned long uint32_t;
|
|||
# error This code can currently only be compiled on Borland's 16-bit DOS compilers. Ideally, you'd only have to declare <stdint.h> types for your compiler here though?
|
||||
#endif
|
||||
/// ----------
|
||||
|
||||
// Both Turbo C++ and master.lib use uint16_t for segment values throughout
|
||||
// their APIs instead of the more sensible void __seg*. Maybe, integer
|
||||
// arithmetic on segment values was widely considered more important than
|
||||
// dereferencing?
|
||||
typedef uint16_t seg_t;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <io.h>
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
#include "platform.h"
|
||||
|
||||
#define MDRV2 0xf2
|
||||
#define MDRV2_CALL(func) { \
|
||||
|
@ -54,7 +55,7 @@ static void near pascal mdrv2_load(const char *fn, char func)
|
|||
if(mdrv2_have_board) {
|
||||
int handle = open(fn, O_BINARY | O_RDONLY);
|
||||
int length = filelength(handle);
|
||||
int sgm;
|
||||
seg_t sgm;
|
||||
int ofs;
|
||||
void far *block;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ void resident_stuff_set(
|
|||
char rank, char bgm_mode, char bombs, char start_lives_extra, long rand
|
||||
)
|
||||
{
|
||||
unsigned res = resdata_exist(res_id, RES_ID_STRLEN, RES_PARASIZE);
|
||||
seg_t res = resdata_exist(res_id, RES_ID_STRLEN, RES_PARASIZE);
|
||||
if(!res) {
|
||||
res = resdata_create(res_id, RES_ID_STRLEN, RES_PARASIZE);
|
||||
reiidenconfig = MK_FP(res, 0);
|
||||
|
@ -42,7 +42,7 @@ int resident_stuff_get(
|
|||
int *stage
|
||||
)
|
||||
{
|
||||
unsigned res = resdata_exist(res_id, RES_ID_STRLEN, RES_PARASIZE);
|
||||
seg_t res = resdata_exist(res_id, RES_ID_STRLEN, RES_PARASIZE);
|
||||
if(res) {
|
||||
reiidenconfig = MK_FP(res, 0);
|
||||
*rank = reiidenconfig->rank;
|
||||
|
@ -59,7 +59,7 @@ int resident_stuff_get(
|
|||
|
||||
void resident_free(void)
|
||||
{
|
||||
unsigned res = resdata_exist(res_id, RES_ID_STRLEN, RES_PARASIZE);
|
||||
seg_t res = resdata_exist(res_id, RES_ID_STRLEN, RES_PARASIZE);
|
||||
if(res) {
|
||||
resdata_free(res);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ int unused_6;
|
|||
|
||||
int pascal cfg_load(void)
|
||||
{
|
||||
int resident_sgm;
|
||||
seg_t resident_sgm;
|
||||
|
||||
file_ropen(CFG_FN);
|
||||
file_seek(offsetof(huuma_cfg_t, resident_sgm), 0);
|
||||
|
|
|
@ -20,7 +20,7 @@ char snd_bgm_mode;
|
|||
static int unused_2;
|
||||
unsigned int idle_frames;
|
||||
unsigned char demo_num;
|
||||
unsigned int mikoconfig_sgm;
|
||||
void __seg *mikoconfig_sgm;
|
||||
putfunc_t near *putfunc;
|
||||
|
||||
// No, we don't want to put these two into th02.h. Apparently, declaring
|
||||
|
|
|
@ -215,7 +215,7 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
huuma_options_t opts;
|
||||
int resident_sgm;
|
||||
void __seg *resident_sgm;
|
||||
int8_t debug;
|
||||
} huuma_cfg_t;
|
||||
#pragma option -a.
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
char debug = 0;
|
||||
|
||||
void cfg_write(int mikoconfig_sgm)
|
||||
void cfg_write(seg_t mikoconfig_sgm)
|
||||
{
|
||||
static const huuma_options_t opts_default = {
|
||||
RANK_NORMAL, SND_BGM_FM, 3, 2, 0
|
||||
|
@ -58,7 +58,7 @@ int main(int argc, const char **argv)
|
|||
static const char INITIALIZED[] =
|
||||
"それでは、よろしくお願いします\n\n";
|
||||
|
||||
int sgm;
|
||||
seg_t sgm;
|
||||
const char *res_id = MIKOConfig;
|
||||
int i;
|
||||
char far *mikoconfig;
|
||||
|
|
|
@ -1 +1 @@
|
|||
extern unsigned int Ems; /* ZUN symbol [MAGNet2010] */
|
||||
extern seg_t Ems; /* ZUN symbol [MAGNet2010] */
|
||||
|
|
|
@ -19,7 +19,7 @@ void pascal far bb_stage_free(void)
|
|||
#endif
|
||||
{
|
||||
if(bb_stage_seg) {
|
||||
hmem_free((unsigned int)bb_stage_seg);
|
||||
hmem_free((seg_t)bb_stage_seg);
|
||||
bb_stage_seg = 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue