home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Phoenix Heaven Sunny 2
/
APPARE2.BIN
/
oh_towns
/
install
/
type.cci
< prev
Wrap
Text File
|
1995-06-20
|
9KB
|
478 lines
# 1 "type.c"
# 1 "type.c"
# 6 "install.h"
char *get_inst_main_mnu();
char *get_inst_imag_mnu();
char *get_inst_tool_mnu();
char *get_inst_snd_mnu();
char *get_inst_game_mnu();
char *get_inst_data_mnu();
int disp_desktop();
int syl_clear();
int syl_putf(char *form);
char *add_path_fn(char *path, char *fn);
int tif_load(char *fn);
int tiflist_disp( char **list );
int mveplay(char *fn, int loop);
int exprun(char *fn, char *para);
int inst_help( int evNo, char *evDat, char *fn);
int install_end( char *soft_name, int err );
int install_exec( char *probuf );
int item_setApl( int drv, int icon, char *ttl, char *path, char *para, int att );
# 20 "type.c"
int DrvInst = -1;
int PltNoWhite = 5;
int ColBoxNormal = 0;
int ColBoxInfo = 0;
int ColBoxCaution = 0;
int ColBoxError = 0;
int ColMesh = 0;
int init();
int term();
int install_main();
int set_debug_menu(char *mnu);
int main(int argc, char **argv)
{
init();
install_main();
term();
return (0);
}
int init()
{
char msg[80], tmp[128];
char *mnu;
char *msgMenu[(0)];
char *img;
int winBasCol;
APL_init((0x030A),1,1);
LHA_sysInit((0));
disp_desktop();
SCN_wrtPage(1);
tmp[0] = 0;
tmp[1] = 255;
tmp[2] = 255;
tmp[3] = 255;
SCN_palette(0,PltNoWhite,tmp);
SCN_wrtPage(1);
winBasCol = 0;
winBasCol = (_ScnCol_though);
APL_openBaseWin(winBasCol);
SCN_wrtPage(1);
sprintf(msg,"%c%c", Gaiji_ohFMTOWNS>>8, Gaiji_ohFMTOWNS&0xFF);
APL_openTopBarMenu(Fnt16x16,msg,(_ScnColTbl[12]), (0),Fnt16x12,msgMenu,(_ScnCol_black));
APL_setExitEvt("EXIT",(9999),"exit_chk");
AplDtaInit();
ColBoxNormal = SCN_tile_newMixCol(ColBoxNormal ,(0x00),(_ScnCol_dark) ,(_ScnColTbl[ 7]));
ColBoxInfo = SCN_tile_newMixCol(ColBoxInfo ,(0x00),(_ScnColTbl[12]) ,(_ScnColTbl[ 7]));
ColBoxError = SCN_tile_newMixCol(ColBoxError ,(0x00),(_ScnColTbl[10]) ,(_ScnColTbl[ 7]));
ColBoxCaution = SCN_tile_newMixCol(ColBoxCaution,(0x00),(_ScnColTbl[14]),(_ScnColTbl[ 7]));
ColMesh = SCN_tile_newMixCol(ColMesh ,(0x00),(_ScnCol_though),(_ScnColTbl[ 7]));
return ((0));
}
int term()
{
char tmp[256];
FS_chdrv(toupper(DirStart[0]) - 'A');
sprintf(tmp,"%s.",DirStart);
FS_chdir(tmp);
APL_term();
}
int disp_desktop()
{
char tmp[256];
sprintf(tmp,"%sWALL/%s", DirStart, "_oht508.tif" );
return tif_load(tmp);
}
int install_main()
{
char tmp[256];
int ret,x,y;
char *fn;
fn = "/OH_TOWNS/readme.doc";
SCN_wrtPage(1);
syl_clear();
_apl_wait(100 * 2);
while ( PD_getp(&x,&y) )
;
FS_chdrv(toupper(DirStart[0]) - 'A');
sprintf(tmp,"%s.",DirStart);
FS_chdir(tmp);
APL_textView(Rom16x16,608,391-32,17,fn,"FILE : %s", fn);
_apl_wait(100 * 2);
while ( PD_getp(&x,&y) )
;
return (0);
}
# 5 "instlib.c"
int _puts_bold(int x, int y, int col, char *s);
# 11 "instlib.c"
int syl_clear()
{
char *msg, tmp[80];
SCN_wrtPage(1);
PD_curDec();
sprintf(tmp,"PRESENTED by %c%c", Gaiji_ohFMTOWNS>>8, Gaiji_ohFMTOWNS&0xFF );
msg = "天晴CD Vol.2 鳳凰の巻";
SCN_boxf(0,464,639,479,0,ColMesh);
_puts_bold( 232 ,464 , PltNoWhite,msg);
SCN_puts(Fnt16x16,tmp,232+23*8+1,464+1,0,(_ScnCol_black) ,0);
SCN_puts(Fnt16x16,tmp,232+23*8 ,464 ,0,PltNoWhite,0);
# 35 "instlib.c"
PD_curInc();
}
# 42 "instlib.c"
int syl_putf(char *form)
{
char tmp[256];
char *ap;
int n, x;
(ap = (char *)(&form) + sizeof(int));
vsprintf(tmp+6,form,ap);
;
SCN_wrtPage(1);
PD_curDec();
SCN_boxf(0,464,639,479,0,ColMesh);
EGB_textDirection(EgbPtr,0);
EGB_textDisplayDirection(EgbPtr,0);
EGB_textSpace(EgbPtr,0);
EGB_textZoom(EgbPtr,0, 8, 16 );
EGB_textZoom(EgbPtr,1, 16, 16 );
EGB_fontStyle(EgbPtr,1+4);
EGB_color(EgbPtr,0,(_ScnColTbl[12]));
EGB_color(EgbPtr,1,(_ScnCol_black));
EGB_paintMode(EgbPtr,0x022);
EGB_writeMode(EgbPtr,0);
n = strlen(tmp+6);
x = (640 - n * 8) / 2;
_setWord(tmp+0, x );
_setWord(tmp+2, 464+15);
_setWord(tmp+4, n );
EGB_sjisString( EgbPtr, tmp);
PD_curInc();
}
int _puts_bold(int x, int y, int col, char *s)
{
char para[256];
EGB_textDirection(EgbPtr,0);
EGB_textDisplayDirection(EgbPtr,0);
EGB_textSpace(EgbPtr,0);
EGB_textZoom(EgbPtr,0, 8, 16 );
EGB_textZoom(EgbPtr,1, 16, 16 );
EGB_fontStyle(EgbPtr,1+4);
EGB_color(EgbPtr,0,col );
EGB_color(EgbPtr,1,(_ScnCol_black));
EGB_paintMode(EgbPtr,0x022);
EGB_writeMode(EgbPtr,0);
_setWord(para+0, x );
_setWord(para+2, y+15 );
_setWord(para+4, strlen(s));
strcpy(para+6,s);
EGB_sjisString( EgbPtr, para);
}
char *add_path_fn(char *path, char *fn)
{
int len;
len = strlen(path);
if ( len == 0 || !(path[len-1] == '\\' || path[len-1] == '/') )
path[len++] = FsPathDelim;
strcpy( path + len, fn );
return (path);
}
# 116 "instlib.c"
int tif_load(char *fn)
{
char *img;
short fr[4];
int x, y;
SCN_wrtPage(0);
if ( (img = IMG_open()) != (0) )
{
IMG_setPage(img,0);
IMG_setAtt(img,(0x00010000));
IMG_setColor( img, (_ScnCol_black), (_ScnCol_white));
if ( IMG_load(img,fn) == (0) )
{
IMG_getFr(img,fr);
x = (320 - (fr[2] - fr[0] + 1)) / 2;
y = 10 + (230 - (fr[3] - fr[1] + 1)) / 2;
IMG_setPos(img,x,y);
EGB_color(EgbPtr,1,(_ScnCol_black));
EGB_clearScreen(EgbPtr);
EGB_paintMode(EgbPtr,0x22);
IMG_dsp(img);
}
IMG_close(img);
}
SCN_wrtPage(1);
return ((0));
}
# 150 "instlib.c"
int tiflist_disp( char **list )
{
int i, x, y, ret, pixel, md, x0, y0;
char *img;
short fr[4];
char *fn;
SCN_wrtPage(1);
APL_save_desktop();
SCN_boxf(0,0,639,479,0,0);
SCN_wrtPage(0);
for ( i = 0; list[i] != (0); ++i )
{
fn = list[i];
if ( (img = IMG_open()) != (0) )
{
IMG_setAtt(img,(0x00010000));
if ( IMG_load(img,fn) == (0) )
{
IMG_getFr(img,fr);
pixel = IMG_getPixel(img);
switch ( pixel )
{
case 1:
case 4:
x0 = (640 - (fr[2] - fr[0] + 1)) / 2;
y0 = (480 - (fr[3] - fr[1] + 1)) / 2;
md = 3;
break;
case 8:
x0 = (640 - (fr[2] - fr[0] + 1)) / 2;
y0 = (480 - (fr[3] - fr[1] + 1)) / 2;
md = 12;
break;
case 16:
if ( fr[2] - fr[0] + 1 <= 320 )
{
x0 = (320 - (fr[2] - fr[0] + 1)) / 2;
y0 = (240 - (fr[3] - fr[1] + 1)) / 2;
md = 10;
} else
{
x0 = (512 - (fr[2] - fr[0] + 1)) / 2;
y0 = (480 - (fr[3] - fr[1] + 1)) / 2;
md = 17;
}
break;
default:
goto _TIF_ERR;
}
IMG_setPos(img,x0,y0);
PD_curOff();
EGB_displayPage(EgbPtr,0,0);
EGB_writePage(EgbPtr,0);
EGB_clearScreen(EgbPtr);
EGB_resolution(EgbPtr,0,md);
if ( md == 3 || md == 10 )
{
EGB_resolution(EgbPtr,1,3);
EGB_writePage(EgbPtr,1);
EGB_clearScreen(EgbPtr);
}
EGB_writePage(EgbPtr,0);
if ( md == 10 )
{
EGB_displayStart(EgbPtr,2,2,2);
EGB_displayStart(EgbPtr,3,320,240);
}
EGB_color(EgbPtr,1,0);
EGB_clearScreen(EgbPtr);
IMG_dsp(img);
if ( md == 3 || md == 10 )
EGB_displayPage(EgbPtr,1,3);
else
EGB_displayPage(EgbPtr,0,1);
_apl_wait(100 * 8);
while ( PD_getp(&x,&y) )
;
}
IMG_close(img);
}
}
EGB_writePage(EgbPtr,0);
EGB_clearScreen(EgbPtr);
SCN_sysReinit();
disp_desktop();
SCN_wrtPage(1);
APL_load_desktop();
syl_clear();
return ((0));
}
int mveplay(char *fnmve, int loop)
{
char para[256];
sprintf(para,"-loop %d %s", loop, fnmve );
exprun("/OH_TOWNS/DEMOTOOL/mveplay.exp", para );
return (0);
}
int exprun(char *fn, char *para)
{
unsigned int siz;
int md;
char tmp[256];
char *dlgTxm;
char *dir;
siz = APL_getFreeMem();
if ( siz < 2 * 1024 * 1024 )
{
dlgTxm = DlgTxm_open(ColBoxError);
DlgTxm_setTitle(dlgTxm,Fnt16x16, "OUT OF MEMORY");
DlgTxm_putf( dlgTxm, Rom16x16, (1),"");
DlgTxm_putf( dlgTxm, Rom16x16, (1),
"メモリ不足のため実行できません。" );
DlgTxm_putf( dlgTxm, Rom16x16, (1),"");
DlgTxm_setBtn( dlgTxm, Fnt16x16, 128, 20, (_ScnCol_black),
(_ScnColTbl[ 7]), (_ScnCol_hilight), (_ScnCol_dark), '\r', 0x7300, 0, "", 0, "OK : [実行]");
DlgTxm_setSize(dlgTxm,480,48);
DlgTxm_setPosition(dlgTxm,(1));
DlgTxm_start(dlgTxm);
DlgTxm_close(dlgTxm);
return (-1);
}
dir = FS_pushDir();
FS_chdrv( toupper(DirStart[0]) - 'A' );
FS_getDnam(tmp,fn);
add_path_fn(tmp,".");
FS_chdir(tmp);
SCN_wrtPage(1);
APL_save_desktop();
md = (4) | (8);
AplDtaInit();
if ( para != (0) && *para != '\0' )
{
AplDtaSetStr("$MainArg","%s %s", fn, para);
if ( strlen(fn) + strlen(para) + 1 >= 128 )
md &= (~(8));
}
FS_popDir(dir);
PCL_exec(fn,md);
SCN_sysReinit();
disp_desktop();
SCN_wrtPage(1);
APL_load_desktop();
syl_clear();
return ((0));
}
# 324 "instlib.c"
int inst_help( int evNo, char *evDat, char *fn)
{
char tmp[256];
FS_chdrv(toupper(DirStart[0]) - 'A');
sprintf(tmp,"%s.",DirStart);
FS_chdir(tmp);
APL_textView(Rom16x16,608,391,17,fn,"HELP FILE : %s", fn);
return (evNo);
}
# 341 "instlib.c"
int install_end( char *soft_name, int err )
{
char *dlgTxm;
int colbox;
char *msg;
msg = err == 0 ? "インストールが終わりました。"
: "インストールに失敗しました。";
colbox = 0;
colbox = SCN_tile_newMixCol(colbox,0x00,(_ScnColTbl[12]),(_ScnColTbl[ 7]));
if ( (dlgTxm = DlgTxm_open(colbox)) != (0) )
{
DlgTxm_setTitle(dlgTxm,Fnt16x16,soft_name);
DlgTxm_putf( dlgTxm, Fnt16x16, (1), "");
DlgTxm_putf( dlgTxm, Fnt16x16, (1), msg );
DlgTxm_putf( dlgTxm, Fnt16x16, (1), "");
DlgTxm_setBtn( dlgTxm, Fnt16x16, 64, 20, (_ScnCol_black), (_ScnColTbl[ 7]), (_ScnCol_hilight), (_ScnCol_dark), '\r' , 0x7300 , 1, "", 0, "OK : [実行]");
DlgTxm_setSize(dlgTxm,480,64);
DlgTxm_setPosition(dlgTxm,(1));
DlgTxm_start(dlgTxm);
DlgTxm_close(dlgTxm);
}
SCN_tile_free(colbox);
}