2015-09-16 03:02:29 +00:00
|
|
|
|
/* ReC98
|
|
|
|
|
* -----
|
|
|
|
|
* 1st part of ZUN_RES.COM. Initializes the resident structure and
|
2020-02-21 21:10:47 +00:00
|
|
|
|
* configuration file required in order to run TH02.
|
2015-09-16 03:02:29 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
#include "th02/th02.h"
|
2020-02-18 18:46:34 +00:00
|
|
|
|
#include "th02/snd/snd.h"
|
2015-09-16 03:02:29 +00:00
|
|
|
|
|
|
|
|
|
#pragma option -a1
|
|
|
|
|
|
|
|
|
|
char debug = 0;
|
|
|
|
|
|
2019-12-30 14:48:17 +00:00
|
|
|
|
void cfg_write(seg_t resident_sgm)
|
2015-09-16 03:02:29 +00:00
|
|
|
|
{
|
|
|
|
|
static const huuma_options_t opts_default = {
|
|
|
|
|
RANK_NORMAL, SND_BGM_FM, 3, 2, 0
|
|
|
|
|
};
|
|
|
|
|
static const char HUUMA_CFG[] = CFG_FN;
|
|
|
|
|
|
|
|
|
|
const char *fn = HUUMA_CFG;
|
|
|
|
|
huuma_options_t opts = opts_default;
|
|
|
|
|
int handle = dos_axdx(0x3D02, fn);
|
|
|
|
|
if(handle > 0) {
|
|
|
|
|
dos_seek(handle, sizeof(opts), SEEK_SET);
|
|
|
|
|
} else {
|
|
|
|
|
handle = dos_create(fn, _A_ARCH);
|
|
|
|
|
dos_write(handle, &opts, sizeof(opts));
|
|
|
|
|
}
|
2019-12-30 14:48:17 +00:00
|
|
|
|
dos_write(handle, &resident_sgm, sizeof(resident_sgm));
|
2015-09-16 03:02:29 +00:00
|
|
|
|
dos_write(handle, &debug, sizeof(debug));
|
|
|
|
|
dos_close(handle);
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-21 21:21:20 +00:00
|
|
|
|
#define LOGO \
|
|
|
|
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>^<5E>p<EFBFBD>@ <20>풓<EFBFBD>v<EFBFBD><76><EFBFBD>O<EFBFBD><4F><EFBFBD><EFBFBD><EFBFBD>@ZUN_RES.com Version1.01 (c)zun 1997"
|
|
|
|
|
|
2015-09-16 03:02:29 +00:00
|
|
|
|
int main(int argc, const char **argv)
|
|
|
|
|
{
|
2019-12-26 15:07:35 +00:00
|
|
|
|
int pascal scoredat_verify(void);
|
2015-09-16 03:02:29 +00:00
|
|
|
|
|
2019-12-13 18:17:02 +00:00
|
|
|
|
seg_t sgm;
|
2020-02-21 21:21:20 +00:00
|
|
|
|
const char *res_id = RES_ID;
|
2015-09-16 03:02:29 +00:00
|
|
|
|
int i;
|
2019-12-30 14:48:17 +00:00
|
|
|
|
char far *resident;
|
2015-09-16 03:02:29 +00:00
|
|
|
|
|
|
|
|
|
sgm = resdata_exist(res_id, RES_ID_STRLEN, RES_PARASIZE);
|
2020-02-21 21:21:20 +00:00
|
|
|
|
dos_puts2("\n\n" LOGO "\n");
|
2015-09-16 03:02:29 +00:00
|
|
|
|
graph_clear();
|
2020-02-21 21:21:20 +00:00
|
|
|
|
if(scoredat_verify() == 1) {
|
|
|
|
|
dos_puts2("<EFBFBD>n<EFBFBD>C<EFBFBD>X<EFBFBD>R<EFBFBD>A<EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>́A<CC81><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>x<EFBFBD><78><EFBFBD>s<EFBFBD><73><EFBFBD>ĂˁB\n");
|
|
|
|
|
return 1;
|
2015-09-16 03:02:29 +00:00
|
|
|
|
}
|
|
|
|
|
if(argc == 2) {
|
|
|
|
|
#define arg1_is(capital, small) \
|
|
|
|
|
(argv[1][0] == '-' || argv[1][0] == '/') \
|
|
|
|
|
&& (argv[1][1] == (capital) || argv[1][1] == (small))
|
|
|
|
|
if(arg1_is('R', 'r')) {
|
|
|
|
|
if(!sgm) {
|
2020-02-21 21:21:20 +00:00
|
|
|
|
dos_puts2("<EFBFBD>킽<EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>܂<EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><EFBFBD><EFBFBD><EFBFBD>悧\n\n");
|
|
|
|
|
return 1;
|
2015-09-16 03:02:29 +00:00
|
|
|
|
}
|
|
|
|
|
dos_free(sgm);
|
2020-02-21 21:21:20 +00:00
|
|
|
|
dos_puts2("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȃ<EFBFBD><EFBFBD>A<EFBFBD>܂<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>炢<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\n");
|
2015-09-16 03:02:29 +00:00
|
|
|
|
return 0;
|
|
|
|
|
} else if(arg1_is('D', 'd')) {
|
|
|
|
|
debug = 1;
|
|
|
|
|
} else {
|
2020-02-21 21:21:20 +00:00
|
|
|
|
dos_puts2("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȃI<EFBFBD>v<EFBFBD>V<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><EFBFBD>A<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ł<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\n");
|
|
|
|
|
sgm = sgm; /* optimization barrier #1 */
|
2015-09-16 03:02:29 +00:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(sgm) {
|
2020-02-21 21:21:20 +00:00
|
|
|
|
dos_puts2("<EFBFBD>킽<EFBFBD><EFBFBD><EFBFBD>A<EFBFBD><EFBFBD><EFBFBD>łɂ<EFBFBD><EFBFBD>܂<EFBFBD><EFBFBD>悧\n\n");
|
|
|
|
|
argv = argv; /* optimization barrier #2 */
|
2015-09-16 03:02:29 +00:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
sgm = resdata_create(res_id, RES_ID_STRLEN, RES_PARASIZE);
|
|
|
|
|
if(!sgm) {
|
2020-02-21 21:21:20 +00:00
|
|
|
|
dos_puts2("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>킽<EFBFBD><EFBFBD><EFBFBD>̋<EFBFBD><EFBFBD>ꏊ<EFBFBD><EFBFBD><EFBFBD>Ȃ<EFBFBD><EFBFBD>́I\n\n");
|
2015-09-16 03:02:29 +00:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
2019-12-30 14:48:17 +00:00
|
|
|
|
resident = MK_FP(sgm, 0);
|
2020-02-21 21:21:20 +00:00
|
|
|
|
dos_puts2("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ł́A<EFBFBD><EFBFBD><EFBFBD>낵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>肢<EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD>\n\n");
|
2015-09-16 03:02:29 +00:00
|
|
|
|
for(i = offsetof(resident_t, stage); i < sizeof(resident_t); i++) {
|
2019-12-30 14:48:17 +00:00
|
|
|
|
resident[i] = 0;
|
2015-09-16 03:02:29 +00:00
|
|
|
|
}
|
|
|
|
|
cfg_write(sgm);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma codestring "\x00"
|