예제 #1
0
파일: dlgabout.cpp 프로젝트: histat/dc-xmil
void dlgabout()
{
	char work[32];
	const char str_auth[] = "Yui/Punyu/Studio Milmake";
	float x,y;

	tx_resetwork();
	icon.create_texture();
  
	milstr_ncpy(work, str_xmil, NELEMENTS(work));
	milstr_ncat(work, str_space, NELEMENTS(work));
	milstr_ncat(work, xmilversion, NELEMENTS(work));

	float base_width = MAX_MENU_SIZE;
	float base_height = (ui_font_height() + 5) * 3 + (32 + 5) + 6;

	float offx = ui_offx() + (ui_width() - base_width) / 2;
	float offy = ui_offy() + (ui_height() - base_height) / 2;

	tx_resetfont();
  
	scrnmng_update();
	draw_transquad(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, UI_TR, UI_TR, UI_TR, UI_TR);
	draw_transquad(offx, offy, offx + base_width, offy + base_height, UI_BS, UI_BS, UI_BS, UI_BS);

	x = offx + (base_width - strlen(mstr_about) * ui_font_width()) / 2;
	y = offy;
	ui_font_draw(x, y, 255, 255, 255, mstr_about);
	y += ui_font_height() + 5;

	draw_transquad(offx, y, offx + base_width, y + 1, MAKECOL32(128, 128, 128, 255),
				   MAKECOL32(128, 128, 128, 255), MAKECOL32(128, 128, 128, 255), MAKECOL32(128, 128, 128, 255));

	y += 6;
  
	x = offx + (base_width - strlen(work) * ui_font_width()) / 2;
	ui_font_draw(x, y, 255, 255, 255, work);
	y += ui_font_height() + 5;

	x = offx + (base_width - 32) / 2;
	icon.drawIcon(x, y);
	y += 32 + 5;

	x = offx + (base_width - strlen(str_auth) * ui_font_width()) / 2;
	ui_font_draw(x, y, 255, 255, 255, str_auth);

	x = ui_offx();
	y = ui_height() - ui_font_height();
  
	ui_font_draw(x, y, 255, 255, 255, "B:Back");
    
	ta_commit_frame();
  
	for (;;) {
		uisys_task();

		if(ui_keypressed(JOY_B))
			break;
	}
}
예제 #2
0
static void onInitDialog(HWND hWnd)
{
	TCHAR	szWork[128];
	RECT	rect;
	RECT	rectMore;
	RECT	rectInfo;
	int		nHeight;
	POINT	pt;

	milstr_ncpy(szWork, str_np2title, NELEMENTS(szWork));
	milstr_ncat(szWork, np2version, NELEMENTS(szWork));
#if defined(NP2VER_WIN9X)
	milstr_ncat(szWork, NP2VER_WIN9X, NELEMENTS(szWork));
#endif
	SetDlgItemText(hWnd, IDC_NP2VER, szWork);

	GetWindowRect(hWnd, &rect);
	s_szAbout.cx = rect.right - rect.left;
	s_szAbout.cy = rect.bottom - rect.top;

	if ((dlgs_getitemrect(hWnd, IDC_MORE, &rectMore)) &&
		(dlgs_getitemrect(hWnd, IDC_NP2INFO, &rectInfo)))
	{
		nHeight = s_szAbout.cy - (rectInfo.bottom - rectMore.bottom);
		GetClientRect(GetParent(hWnd), &rect);
		pt.x = (rect.right - rect.left - s_szAbout.cx) / 2;
		pt.y = (rect.bottom - rect.top - s_szAbout.cy) / 2;
		ClientToScreen(GetParent(hWnd), &pt);
		np2class_move(hWnd, pt.x, pt.y, s_szAbout.cx, nHeight);
	}

	SetFocus(GetDlgItem(hWnd, IDOK));
}
예제 #3
0
파일: statsave.c 프로젝트: aliaspider/np2
void statflag_seterr(STFLAGH sfh, const OEMCHAR *str) {

	if ((sfh) && (sfh->errlen)) {
		milstr_ncat(sfh->err, str, sfh->errlen);
		milstr_ncat(sfh->err, CRCONST, sfh->errlen);
	}
}
예제 #4
0
void
create_about_dialog(void)
{
	char work[256];
	GtkWidget *about_dialog;
	GtkWidget *main_widget;
	GtkWidget *ver_label;
	GtkWidget *ok_button;
	GtkWidget *neko_image;
	GdkColormap *colormap;
	GdkPixmap *neko_pixmap;
	GdkBitmap *mask;

	uninstall_idle_process();

	about_dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(about_dialog), "About Neko Project II");
	gtk_window_set_position(GTK_WINDOW(about_dialog), GTK_WIN_POS_CENTER);
	gtk_window_set_modal(GTK_WINDOW(about_dialog), TRUE);
	gtk_window_set_resizable(GTK_WINDOW(about_dialog), FALSE);
	gtk_container_set_border_width(GTK_CONTAINER(about_dialog), 10);
	g_signal_connect(GTK_OBJECT(about_dialog), "destroy",
	    GTK_SIGNAL_FUNC(about_destroy), NULL);

	main_widget = gtk_hbox_new(FALSE, 3);
	gtk_widget_show(main_widget);
	gtk_container_add(GTK_CONTAINER(about_dialog), main_widget);

	colormap = gtk_widget_get_colormap(about_dialog);
	neko_pixmap = gdk_pixmap_colormap_create_from_xpm_d(NULL, colormap,
	    &mask, NULL, (gchar **)np2_icon);
	if (neko_pixmap == NULL)
		g_error("Couldn't create replacement pixmap.");
	neko_image = gtk_image_new_from_pixmap(neko_pixmap, mask);
	g_object_unref(neko_pixmap);
	g_object_unref(mask);
	gtk_widget_show(neko_image);
	gtk_box_pack_start(GTK_BOX(main_widget), neko_image, FALSE, FALSE, 10);

	milstr_ncpy(work, "Neko Project II\n", sizeof(work));
	milstr_ncat(work, NP2VER_CORE, sizeof(work));
#if defined(NP2VER_X11)
	milstr_ncat(work, NP2VER_X11, sizeof(work));
#endif
	ver_label = gtk_label_new(work);
	gtk_widget_show(ver_label);
	gtk_box_pack_start(GTK_BOX(main_widget), ver_label, FALSE, FALSE, 10);

	ok_button = gtk_button_new_from_stock(GTK_STOCK_OK);
	gtk_widget_show(ok_button);
	gtk_box_pack_end(GTK_BOX(main_widget), ok_button, FALSE, TRUE, 0);
	g_signal_connect_swapped(GTK_OBJECT(ok_button), "clicked",
	    GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(about_dialog));
	GTK_WIDGET_SET_FLAGS(ok_button, GTK_CAN_DEFAULT);
	GTK_WIDGET_SET_FLAGS(ok_button, GTK_HAS_DEFAULT);
	gtk_widget_grab_default(ok_button);

	gtk_widget_show_all(about_dialog);
}
예제 #5
0
void
create_about_dialog(void)
{
    char work[256];
    GtkWidget *about_dialog;
    GtkWidget *main_widget;
    GtkWidget *ver_label;
    GtkWidget *ok_button;
    GtkWidget *neko_image;
    GdkPixbuf *neko_pixbuf;

    uninstall_idle_process();

    about_dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(about_dialog), "About Neko Project II");
    gtk_window_set_position(GTK_WINDOW(about_dialog), GTK_WIN_POS_CENTER);
    gtk_window_set_modal(GTK_WINDOW(about_dialog), TRUE);
    gtk_window_set_resizable(GTK_WINDOW(about_dialog), FALSE);
    gtk_container_set_border_width(GTK_CONTAINER(about_dialog), 10);
    g_signal_connect(GTK_OBJECT(about_dialog), "destroy",
                     G_CALLBACK(about_destroy), NULL);

    main_widget = gtk_hbox_new(FALSE, 3);
    gtk_widget_show(main_widget);
    gtk_container_add(GTK_CONTAINER(about_dialog), main_widget);

    neko_pixbuf = gdk_pixbuf_new_from_xpm_data(np2_icon);
    neko_image = gtk_image_new_from_pixbuf(neko_pixbuf);
    g_object_unref(neko_pixbuf);
    gtk_widget_show(neko_image);
    gtk_box_pack_start(GTK_BOX(main_widget), neko_image, FALSE, FALSE, 10);

    milstr_ncpy(work, "Neko Project II\n", sizeof(work));
    milstr_ncat(work, NP2VER_CORE, sizeof(work));
#if defined(NP2VER_X11)
    milstr_ncat(work, NP2VER_X11, sizeof(work));
#endif
    ver_label = gtk_label_new(work);
    gtk_widget_show(ver_label);
    gtk_box_pack_start(GTK_BOX(main_widget), ver_label, FALSE, FALSE, 10);

    ok_button = gtk_button_new_from_stock(GTK_STOCK_OK);
    gtk_widget_show(ok_button);
    gtk_box_pack_end(GTK_BOX(main_widget), ok_button, FALSE, TRUE, 0);
    g_signal_connect_swapped(GTK_OBJECT(ok_button), "clicked",
                             G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(about_dialog));
#if GTK_MAJOR_VERSION > 2 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 18)
    gtk_widget_set_can_default(ok_button, TRUE);
    gtk_widget_has_default(ok_button);
#else
    GTK_WIDGET_SET_FLAGS(ok_button, GTK_CAN_DEFAULT);
    GTK_WIDGET_SET_FLAGS(ok_button, GTK_HAS_DEFAULT);
#endif
    gtk_widget_grab_default(ok_button);

    gtk_widget_show_all(about_dialog);
}
예제 #6
0
파일: sdlvideo.c 프로젝트: perabuss/np2wii
void SDL_WM_SetCaption(const char *title, const char *icon) {

	char	caption[256];

	milstr_ncpy(caption, "SDL", sizeof(caption));
	if (title) {
		milstr_ncat(caption, " - ", sizeof(caption));
		milstr_ncat(caption, title, sizeof(caption));
	}
	SetWindowText(__sdl_hWnd, caption);
}
예제 #7
0
const OEMCHAR *debugsub_regs(void) {

static OEMCHAR	work[256];

	OEMSPRINTF(work, str_register,	CPU_EAX, CPU_EBX, CPU_ECX, CPU_EDX,
									CPU_ESP, CPU_EBP, CPU_ESI, CPU_EDI,
									CPU_DS, CPU_ES, CPU_SS, CPU_CS, CPU_EIP);
	milstr_ncat(work, debugsub_flags(CPU_FLAG), NELEMENTS(work));
	milstr_ncat(work, CRCONST, NELEMENTS(work));
	return(work);
}
예제 #8
0
파일: dosio.c 프로젝트: FREEWING-JP/np2pi
BOOL file_listnext(FLISTH hdl, FLINFO *fli) {

	OEMCHAR buf[MAX_PATH];
	struct dirent *de;
	struct stat sb;

	de = readdir(hdl->hdl);
	if (de == NULL) {
		return FAILURE;
	}

	milstr_ncpy(buf, hdl->path, sizeof(buf));
	milstr_ncat(buf, de->d_name, sizeof(buf));
	if (stat(buf, &sb) != 0) {
		return FAILURE;
	}

	fli->caps = FLICAPS_SIZE | FLICAPS_ATTR;
	fli->size = sb.st_size;
	fli->attr = 0;
	if (S_ISDIR(sb.st_mode)) {
		fli->attr |= FILEATTR_DIRECTORY;
	}
	if (!(sb.st_mode & S_IWUSR)) {
		fli->attr |= FILEATTR_READONLY;
	}
	milstr_ncpy(fli->path, de->d_name, sizeof(fli->path));
	return SUCCESS;
}
예제 #9
0
파일: np2info.c 프로젝트: histat/dc-np2
static void info_grph(OEMCHAR *str, int maxlen, const NP2INFOEX *ex) {

const OEMCHAR	*p;
	UINT		md;
	UINT		pg;
	OEMCHAR		work[32];

	if (!(gdcs.grphdisp & GDCSCRN_ENABLE)) {
		p = str_disable;
	}
	else {
		md = (gdc.analog & (1 << GDCANALOG_16))?1:0;
		pg = gdcs.access;
#if defined(SUPPORT_PC9821)
		if (gdc.analog & (1 << (GDCANALOG_256))) {
			md = 2;
			if (gdc.analog & (1 << (GDCANALOG_256E))) {
				pg = 2;
			}
		}
#endif
		milstr_ncpy(work, milstr_list(str_vrammode, md), NELEMENTS(work));
		milstr_ncat(work, milstr_list(str_vrampage, pg), NELEMENTS(work));
		p = work;
	}
	milstr_ncpy(str, p, maxlen);
	(void)ex;
}
예제 #10
0
파일: np2info.c 프로젝트: histat/dc-np2
static void info_extsnd(OEMCHAR *str, int maxlen, const NP2INFOEX *ex) {

	OEMCHAR	buf[64];

	info_sound(str, maxlen, ex);
	if (usesound & 4) {
		milstr_ncat(str, ex->cr, maxlen);
		OEMSPRINTF(buf, str_pcm86a,
							pcm86rate8[pcm86.fifo & 7] >> 3,
							(16 - ((pcm86.dactrl >> 3) & 8)),
							milstr_list(str_chpan, (pcm86.dactrl >> 4) & 3));
		milstr_ncat(str, buf, maxlen);
		milstr_ncat(str, ex->cr, maxlen);
		OEMSPRINTF(buf, str_pcm86b, pcm86.virbuf, pcm86.fifosize);
		milstr_ncat(str, buf, maxlen);
	}
예제 #11
0
BOOL
file_listnext(FLISTH hdl, FLINFO *fli)
{
	OEMCHAR buf[MAX_PATH];
	struct dirent *de;
	struct stat sb;

	de = readdir(hdl->hdl);
	if (de == NULL) {
		VERBOSE(("file_listnext: readdir failure"));
		return FAILURE;
	}

	milstr_ncpy(buf, hdl->path, sizeof(buf));
	milstr_ncat(buf, de->d_name, sizeof(buf));
	if (stat(buf, &sb) != 0) {
		VERBOSE(("file_listnext: stat failure. (path = %s)", buf));
		return FAILURE;
	}

	fli->caps = FLICAPS_SIZE | FLICAPS_ATTR | FLICAPS_DATE | FLICAPS_TIME;
	fli->size = sb.st_size;
	fli->attr = 0;
	if (S_ISDIR(sb.st_mode)) {
		fli->attr |= FILEATTR_DIRECTORY;
	}
	if (!(sb.st_mode & S_IWUSR)) {
		fli->attr |= FILEATTR_READONLY;
	}
	cnvdatetime(&sb, &fli->date, &fli->time);
	milstr_ncpy(fli->path, de->d_name, sizeof(fli->path));
	VERBOSE(("file_listnext: success"));
	return SUCCESS;
}
예제 #12
0
파일: sysmng.cpp 프로젝트: LasDesu/np2debug
void sysmng_updatecaption(UINT8 flag) {

	OEMCHAR	work[512];
	static OEMCHAR	title[512];
	static OEMCHAR	clock[64];

	if (flag & 1) {
		title[0] = '\0';
		if (fdd_diskready(0)) {
			milstr_ncat(title, OEMTEXT("  FDD1:"), NELEMENTS(title));
			milstr_ncat(title, file_getname(fdd_diskname(0)), NELEMENTS(title));
		}
		if (fdd_diskready(1)) {
			milstr_ncat(title, OEMTEXT("  FDD2:"), NELEMENTS(title));
			milstr_ncat(title, file_getname(fdd_diskname(1)), NELEMENTS(title));
		}
	}
	if (flag & 2) {
		clock[0] = '\0';
		if (np2oscfg.DISPCLK & 2) {
			if (workclock.fps) {
				OEMSPRINTF(clock, OEMTEXT(" - %u.%1uFPS"),
									workclock.fps / 10, workclock.fps % 10);
			}
			else {
				milstr_ncpy(clock, OEMTEXT(" - 0FPS"), NELEMENTS(clock));
			}
		}
		if (np2oscfg.DISPCLK & 1) {
			OEMSPRINTF(work, OEMTEXT(" %2u.%03uMHz"),
								workclock.khz / 1000, workclock.khz % 1000);
			if (clock[0] == '\0') {
				milstr_ncpy(clock, OEMTEXT(" -"), NELEMENTS(clock));
			}
			milstr_ncat(clock, work, sizeof(clock));
#if 0
			OEMSPRINTF(work, OEMTEXT(" (debug: OPN %d / PSG %s)"),
							opngen.playing,
							(g_psg1.mixer & 0x3f)?OEMTEXT("ON"):OEMTEXT("OFF"));
			milstr_ncat(clock, work, NELEMENTS(clock));
#endif
		}
	}
	milstr_ncpy(work, np2oscfg.titles, NELEMENTS(work));
	milstr_ncat(work, title, NELEMENTS(work));
	milstr_ncat(work, clock, NELEMENTS(work));
	if(np2stopemulate)
	{
		milstr_ncat(work, OEMTEXT(" (paused)"), NELEMENTS(work));
	}
	SetWindowText(g_hWndMain, work);
}
예제 #13
0
파일: moviemng.c 프로젝트: nonakap/xkazoku
void moviemng_play(const char *fname, SCRN_T *scrn) {

    DAMEDEC	prm;
    char	path[MAX_PATH];
    char	*p;
    int		r;

    menubase_close();
    inputmng_resetmouse(0);

    milstr_ncpy(path, gamecore.suf.scriptpath, sizeof(path));
    milstr_ncat(path, fname, sizeof(path));
    cutExtName(path);
    milstr_ncat(path, ".MVD", sizeof(path));
    p = getFileName(path);
    while(*p) {
        if ((((p[0] ^ 0x20) - 0xa1) & 0xff) < 0x3c) {
            if (p[1] != '\0') {
                p++;
            }
        }
        else if (((p[0] - 0x41) & 0xdf) < 26) {
            p[0] &= 0xdf;
        }
        p++;
    }
    prm.movie = path;
    prm.decproc = DAMEDEC_NOR;
    prm.draw = mvdraw;
    prm.task = mvtask;
    prm.sndplay = mvsndplay;
    prm.sndstop = mvsndstop;
    movieplaying = TRUE;
    r = damedec_play(&prm);
    if (r < 0) {
        TRACEOUT(("damelib error: %d [%s]", r, path));
    }
    movieplaying = 0;

    (void)scrn;
}
예제 #14
0
파일: sysmng.c 프로젝트: aliaspider/np2
void
sysmng_updatecaption(UINT8 flag)
{
    char work[512];

    if (flag & 1) {
        titlestr[0] = '\0';
        if (fdd_diskready(0)) {
            milstr_ncat(titlestr, "  FDD1:", sizeof(titlestr));
            milstr_ncat(titlestr, file_getname((char *)fdd_diskname(0)), sizeof(titlestr));
        }
        if (fdd_diskready(1)) {
            milstr_ncat(titlestr, "  FDD2:", sizeof(titlestr));
            milstr_ncat(titlestr, file_getname((char *)fdd_diskname(1)), sizeof(titlestr));
        }
#if defined(SUPPORT_IDEIO)
        if (sxsi_getfilename(0x02)) {
            milstr_ncat(titlestr, "  CD-ROM:", sizeof(titlestr));
            milstr_ncat(titlestr, file_getname((OEMCHAR *)sxsi_getfilename(0x02)), sizeof(titlestr));
        }
#endif
    }
    if (flag & 2) {
        clockstr[0] = '\0';
        if (np2oscfg.DISPCLK & 2) {
            if (workclock.fps) {
                g_snprintf(clockstr, sizeof(clockstr), " - %u.%1uFPS", workclock.fps / 10, workclock.fps % 10);
            }
            else {
                milstr_ncpy(clockstr, " - 0FPS", sizeof(clockstr));
            }
        }
        if (np2oscfg.DISPCLK & 1) {
            g_snprintf(work, sizeof(work), " %2u.%03uMHz", workclock.khz / 1000, workclock.khz % 1000);
            if (clockstr[0] == '\0') {
                milstr_ncpy(clockstr, " -", sizeof(clockstr));
            }
            milstr_ncat(clockstr, work, sizeof(clockstr));
        }
    }
    milstr_ncpy(work, np2oscfg.titles, sizeof(work));
    milstr_ncat(work, titlestr, sizeof(work));
    milstr_ncat(work, clockstr, sizeof(work));
    toolkit_set_window_title(work);
}
예제 #15
0
const OEMCHAR *debugsub_flags(UINT16 flag) {

static OEMCHAR	work[128];
	int			i;
	UINT16		bit;

	work[0] = 0;
	for (i=0, bit=0x8000; bit; i++, bit>>=1) {
		if (flagstr[i][0]) {
			if (flag & bit) {
				milstr_ncat(work, flagstr[i][1], NELEMENTS(work));
			}
			else {
				milstr_ncat(work, flagstr[i][0], NELEMENTS(work));
			}
			if (bit != 1) {
				milstr_ncat(work, str_space, NELEMENTS(work));
			}
		}
	}
	return(work);
}
예제 #16
0
파일: ini.cpp 프로젝트: utamaro/np2.js
static void binget(OEMCHAR *work, int size, const UINT8 *bin, UINT binlen) {

	UINT	i;
	OEMCHAR	tmp[8];

	if (binlen) {
		OEMSPRINTF(tmp, OEMTEXT("%.2x"), bin[0]);
		milstr_ncpy(work, tmp, size);
	}
	for (i=1; i<binlen; i++) {
		OEMSPRINTF(tmp, OEMTEXT(" %.2x"), bin[i]);
		milstr_ncat(work, tmp, size);
	}
}
예제 #17
0
파일: ini.c 프로젝트: utamaro/np2.js
static void iniwrsetarg8(char *work, int size, const BYTE *ptr, int arg) {

	int		i;
	char	tmp[8];

	if (arg > 0) {
		SPRINTF(tmp, "%.2x", ptr[0]);
		milstr_ncpy(work, tmp, size);
	}
	for (i=1; i<arg; i++) {
		SPRINTF(tmp, " %.2x", ptr[i]);
		milstr_ncat(work, tmp, size);
	}
}
예제 #18
0
파일: gamecore.c 프로젝트: nonakap/xkazoku
static void readsuf(const char *path) {

	SYS_T	*sys;
	SUF_T	*suf;
	char	subpath[MAX_PATH];

	sys = &gamecore.sys;
	suf = &gamecore.suf;
	gamedef_loadsuf(path, suf, sys);
	if (archive_throwall(suf->scriptpath) != SUCCESS) {
		milstr_ncpy(subpath, suf->scriptpath, sizeof(subpath));
		plusyen(subpath, sizeof(subpath));
		milstr_ncat(subpath, suf->key, sizeof(subpath));
		archive_throwall(subpath);
	}
}
예제 #19
0
파일: ini.cpp 프로젝트: aliaspider/np2
/**
 * バイナリをシリアライズ
 * @param[out] lpString 文字列バッファ
 * @param[in] cchString 文字列バッファ長
 * @param[in] lpBin バイナリ
 * @param[in] cbBin バイナリのサイズ
 */
static void binget(LPTSTR lpString, int cchString, const void* lpBin, UINT cbBin)
{

	if (cbBin)
	{
		TCHAR tmp[8];
		wsprintf(tmp, TEXT("%.2x"), (static_cast<const UINT8*>(lpBin))[0]);
		milstr_ncpy(lpString, tmp, cchString);
	}
	for (UINT i = 1; i < cbBin; i++)
	{
		TCHAR tmp[8];
		wsprintf(tmp, TEXT(" %.2x"), (static_cast<const UINT8*>(lpBin))[i]);
		milstr_ncat(lpString, tmp, cchString);
	}
}
예제 #20
0
파일: moviemng.c 프로젝트: nonakap/xkazoku
static void *mvsndplay(const char *movie, BYTE *ptr, UINT size) {

    ONMEMSTMARG		arg;
    char			path[MAX_PATH];
    UINT			i;
    BOOL			play;

    play = FALSE;
    if (!gamecore.gamecfg.bgm) {
        goto mvsp_exit;
    }
    if ((ptr) && (size)) {
        arg.ptr = ptr;
        arg.size = size;
        soundmix_load(SOUNDTRK_SOUND, onmem_ssopen, &arg);
        play = TRUE;
    }
    if (!play) {
        for (i=0; i<(sizeof(extnames)/sizeof(char *)); i++) {
            milstr_ncpy(path, movie, sizeof(path));
            cutExtName(path);
            milstr_ncat(path, extnames[i], sizeof(path));
            if (!soundmix_load(SOUNDTRK_SOUND, mp3_ssopen, path)) {
                play = TRUE;
                break;
            }
        }
    }
    if (play) {
        soundmix_play(SOUNDTRK_SOUND, 0, 0);
#ifdef WAIT_SOUND
        {
            UINT32 base = GETTICK();
            while((GETTICK() - base) < WAIT_SOUND) {
                if (!taskmng_sleep(1)) {
                    break;
                }
            }
        }
#endif
    }

mvsp_exit:
    return((void *)(long)play);
}
예제 #21
0
파일: ini.c 프로젝트: LasDesu/np2debug
static void
iniwrsetargh8(char *work, int size, INITBL *ini)
{
	char tmp[8];
	const UINT8 *ptr;
	UINT arg;
	UINT i;

	ptr = (UINT8 *)(ini->value);
	arg = ini->arg;
	if (arg > 0) {
		g_snprintf(tmp, sizeof(tmp), "%.2x ", ptr[0]);
		milstr_ncpy(work, tmp, size);
	}
	for (i = 1; i < arg; i++) {
		g_snprintf(tmp, sizeof(tmp), "%.2x ", ptr[i]);
		milstr_ncat(work, tmp, size);
	}
}
예제 #22
0
파일: dosio.cpp 프로젝트: FREEWING-JP/np2pi
void file_catname(char *path, const char *sjis, int maxlen) {

	char	*p;

	p = path + strlen(path);
	milstr_ncat(path, sjis, maxlen);
	while(1) {
		if (ISKANJI(*p)) {
			if (*(p+1) == '\0') {
				break;
			}
			p++;
		}
		else if ((*p == '/') || (*p == '\\')) {
			*p = ':';
		}
		else if (*p == '\0') {
			break;
		}
		p++;
	}
}
예제 #23
0
/*
 * main
 */
int
main(int argc, char *argv[])
{
	struct stat sb;
	BOOL result;
	int rv = 1;
	int ch;
	int i, drvmax;

	progname = argv[0];

	toolkit_initialize();
	toolkit_arginit(&argc, &argv);

	while ((ch = getopt_long(argc, argv, "c:C:t:vh", longopts, NULL)) != -1) {
		switch (ch) {
		case 'c':
			if (stat(optarg, &sb) < 0 || !S_ISREG(sb.st_mode)) {
				fprintf(stderr, "Can't access %s.\n", optarg);
				exit(1);
			}
			milstr_ncpy(modulefile, optarg, sizeof(modulefile));

			/* resume/statsave dir */
			file_cpyname(statpath, modulefile, sizeof(statpath));
			file_cutname(statpath);
			break;

		case 'C':
			if (stat(optarg, &sb) < 0 || !S_ISREG(sb.st_mode)) {
				fprintf(stderr, "Can't access %s.\n", optarg);
				exit(1);
			}
			milstr_ncpy(timidity_cfgfile_path, optarg,
			    sizeof(timidity_cfgfile_path));
			break;

		case 't':
			if (stat(optarg, &sb) < 0 || !S_ISREG(sb.st_mode)) {
				fprintf(stderr, "Can't access %s.\n", optarg);
				exit(1);
			}
			milstr_ncpy(fontfilename, optarg, sizeof(fontfilename));
			break;

		case 'v':
			verbose = 1;
			break;

		case 'h':
		case '?':
		default:
			usage();
			break;
		}
	}
	argc -= optind;
	argv += optind;

	if (modulefile[0] == '\0') {
		char *env = getenv("HOME");
		if (env) {
			/* base dir */
			snprintf(modulefile, sizeof(modulefile),
			    "%s/.np2", env);
			if (stat(modulefile, &sb) < 0) {
				if (mkdir(modulefile, 0700) < 0) {
					perror(modulefile);
					exit(1);
				}
			} else if (!S_ISDIR(sb.st_mode)) {
				fprintf(stderr, "%s isn't directory.\n",
				    modulefile);
				exit(1);
			}

			/* font file */
			snprintf(np2cfg.fontfile, sizeof(np2cfg.fontfile),
			    "%s/font.bmp", modulefile);

			/* resume/statsave dir */
			file_cpyname(statpath, modulefile, sizeof(statpath));
			file_catname(statpath, "/sav/", sizeof(statpath));
			if (stat(statpath, &sb) < 0) {
				if (mkdir(statpath, 0700) < 0) {
					perror(statpath);
					exit(1);
				}
			} else if (!S_ISDIR(sb.st_mode)) {
				fprintf(stderr, "%s isn't directory.\n",
				    statpath);
				exit(1);
			}

			/* config file */
			milstr_ncat(modulefile, "/np2rc", sizeof(modulefile));
			if ((stat(modulefile, &sb) >= 0)
			 && !S_ISREG(sb.st_mode)) {
				fprintf(stderr, "%s isn't regular file.\n",
				    modulefile);
			}
		}
	}
	if (timidity_cfgfile_path[0] == '\0') {
		file_cpyname(timidity_cfgfile_path, modulefile,
		    sizeof(timidity_cfgfile_path));
		file_cutname(timidity_cfgfile_path);
		file_catname(timidity_cfgfile_path, "timidity.cfg",
		    sizeof(timidity_cfgfile_path));
	}

	dosio_init();
	file_setcd(modulefile);
	initload();
	toolwin_readini();
	kdispwin_readini();
	skbdwin_readini();

	rand_setseed((SINT32)time(NULL));

#if defined(GCC_CPU_ARCH_IA32)
	mmxflag = havemmx() ? 0 : MMXFLAG_NOTSUPPORT;
	mmxflag += np2oscfg.disablemmx ? MMXFLAG_DISABLE : 0;
#endif

	TRACEINIT();

	if (fontmng_init() != SUCCESS)
		goto fontmng_failure;

	kdispwin_initialize();
	viewer_init();
	skbdwin_initialize();

	toolkit_widget_create();
	scrnmng_initialize();
	kbdmng_init();
	inputmng_init();
	keystat_initialize();

	scrnmode = 0;
	if (np2cfg.RASTER) {
		scrnmode |= SCRNMODE_HIGHCOLOR;
	}
	if (sysmenu_create() != SUCCESS)
		goto sysmenu_failure;
	if (scrnmng_create(scrnmode) != SUCCESS)
		goto scrnmng_failure;

	if (soundmng_initialize() == SUCCESS) {
		result = soundmng_pcmload(SOUND_PCMSEEK, file_getcd("fddseek.wav"));
		if (!result) {
			result = soundmng_pcmload(SOUND_PCMSEEK, SYSRESPATH "/fddseek.wav");
		}
		if (result) {
			soundmng_pcmvolume(SOUND_PCMSEEK, np2cfg.MOTORVOL);
		}

		result = soundmng_pcmload(SOUND_PCMSEEK1, file_getcd("fddseek1.wav"));
		if (!result) {
			result = soundmng_pcmload(SOUND_PCMSEEK1, SYSRESPATH "/fddseek1.wav");
		}
		if (result) {
			soundmng_pcmvolume(SOUND_PCMSEEK1, np2cfg.MOTORVOL);
		}
	}

	joymng_initialize();
	mousemng_initialize();
	if (np2oscfg.MOUSE_SW) {
		mouse_running(MOUSE_ON);
	}

	commng_initialize();
	sysmng_initialize();
	taskmng_initialize();

	pccore_init();
	S98_init();

	toolkit_widget_show();
	scrndraw_redraw();

	pccore_reset();

	if (!(scrnmode & SCRNMODE_FULLSCREEN)) {
		if (np2oscfg.toolwin) {
			toolwin_create();
		}
		if (np2oscfg.keydisp) {
			kdispwin_create();
		}
		if (np2oscfg.softkbd) {
			skbdwin_create();
		}
	}

#if !defined(CPUCORE_IA32)
	if (np2oscfg.resume) {
		flagload(np2resumeext, "Resume", FALSE);
	}
#endif
	sysmng_workclockreset();

	drvmax = (argc < 4) ? argc : 4;
	for (i = 0; i < drvmax; i++) {
		diskdrv_readyfdd(i, argv[i], 0);
	}

	setup_signal(SIGINT, sighandler);
	setup_signal(SIGTERM, sighandler);

	toolkit_widget_mainloop();
	rv = 0;

	kdispwin_destroy();
	toolwin_destroy();
	skbdwin_destroy();

	pccore_cfgupdate();

	mouse_running(MOUSE_OFF);
	joymng_deinitialize();
	S98_trash();

#if !defined(CPUCORE_IA32)
	if (np2oscfg.resume) {
		flagsave(np2resumeext);
	} else {
		flagdelete(np2resumeext);
	}
#endif

	pccore_term();
	debugwin_destroy();

	soundmng_deinitialize();
	scrnmng_destroy();

scrnmng_failure:
	sysmenu_destroy();

sysmenu_failure:
	fontmng_terminate();

fontmng_failure:
	if (sys_updates & (SYS_UPDATECFG|SYS_UPDATEOSCFG)) {
		initsave();
		toolwin_writeini();
		kdispwin_writeini();
		skbdwin_writeini();
	}

	skbdwin_deinitialize();

	TRACETERM();
	dosio_term();

	viewer_term();
	toolkit_terminate();

	return rv;
}
예제 #24
0
파일: ini.c 프로젝트: LasDesu/np2debug
void
ini_write(const char *path, const char *title, INITBL *tbl, UINT count, BOOL create)
{
	char	work[512];
	INITBL	*p;
	INITBL	*pterm;
	FILEH	fh;
	BOOL	set;

	fh = FILEH_INVALID;
	if (!create) {
		fh = file_open(path);
		if (fh != FILEH_INVALID)
			file_seek(fh, 0L, FSEEK_END);
	}
	if (fh == FILEH_INVALID) {
		fh = file_create(path);
		if (fh == FILEH_INVALID)
			return;
	}

	milstr_ncpy(work, "[", sizeof(work));
	milstr_ncat(work, title, sizeof(work));
	milstr_ncat(work, "]\n", sizeof(work));
	file_write(fh, work, strlen(work));

	p = tbl;
	pterm = tbl + count;
	while (p < pterm) {
		if (!(p->itemtype & INIFLAG_RO) || read_iniread_flag(p)) {
			work[0] = '\0';
			set = SUCCESS;
			switch (p->itemtype & INITYPE_MASK) {
			case INITYPE_STR:
				iniwrsetstr(work, sizeof(work), (char *)p->value);
				break;

			case INITYPE_BOOL:
				milstr_ncpy(work, (*((UINT8 *)p->value)) ? str_true : str_false, sizeof(work));
				break;

			case INITYPE_BITMAP:
				milstr_ncpy(work, inigetbmp((UINT8 *)p->value, p->arg) ? str_true : str_false, sizeof(work));
				break;

			case INITYPE_ARGH8:
				iniwrsetargh8(work, sizeof(work), p);
				break;

			case INITYPE_SINT8:
				g_snprintf(work, sizeof(work), "%d", *((char *)p->value));
				break;

			case INITYPE_SINT16:
				g_snprintf(work, sizeof(work), "%d", *((SINT16 *)p->value));
				break;

			case INITYPE_SINT32:
				g_snprintf(work, sizeof(work), "%d", *((SINT32 *)p->value));
				break;

			case INITYPE_UINT8:
				g_snprintf(work, sizeof(work), "%u", *((UINT8 *)p->value));
				break;

			case INITYPE_UINT16:
				g_snprintf(work, sizeof(work), "%u", *((UINT16 *)p->value));
				break;

			case INITYPE_UINT32:
				g_snprintf(work, sizeof(work), "%u", *((UINT32 *)p->value));
				break;

			case INITYPE_HEX8:
				g_snprintf(work, sizeof(work), "%x", *((UINT8 *)p->value));
				break;

			case INITYPE_HEX16:
				g_snprintf(work, sizeof(work), "%x", *((UINT16 *)p->value));
				break;

			case INITYPE_HEX32:
				g_snprintf(work, sizeof(work), "%x", *((UINT32 *)p->value));
				break;

			case INITYPE_KB:
				if (*(UINT8 *)p->value == KEY_KEY101)
					milstr_ncpy(work, "101", sizeof(work));
				else
					milstr_ncpy(work, "106", sizeof(work));
				break;

			case INITYPE_SNDDRV:
				g_snprintf(work, sizeof(work), "%s", snddrv_num2drv(*(UINT8 *)p->value));
				break;

			case INITYPE_INTERP:
				g_snprintf(work, sizeof(work), "%s", iniwrinterp(*(UINT8 *)p->value));
				break;

			default:
				set = FAILURE;
				break;
			}
			if (set == SUCCESS) {
				file_write(fh, p->item, strlen(p->item));
				file_write(fh, " = ", 3);
				file_write(fh, work, strlen(work));
				file_write(fh, "\n", 1);
			}
		}
		p++;
	}
	file_close(fh);
}
예제 #25
0
파일: ini.c 프로젝트: utamaro/np2.js
void ini_write(const char *path, const char *title,
											const INITBL *tbl, UINT count) {

	FILEH		fh;
const INITBL	*p;
const INITBL	*pterm;
	BOOL		set;
	char		work[512];

	fh = file_create(path);
	if (fh == FILEH_INVALID) {
		return;
	}
	milstr_ncpy(work, "[", sizeof(work));
	milstr_ncat(work, title, sizeof(work));
	milstr_ncat(work, "]\r\n", sizeof(work));
	file_write(fh, work, strlen(work));

	p = tbl;
	pterm = tbl + count;
	while(p < pterm) {
		work[0] = '\0';
		set = SUCCESS;
		switch(p->itemtype) {
			case INITYPE_STR:
				iniwrsetstr(work, sizeof(work), (char *)p->value);
				break;

			case INITYPE_BOOL:
				milstr_ncpy(work, (*((BYTE *)p->value))?str_true:str_false,
																sizeof(work));
				break;

			case INITYPE_BYTEARG:
				iniwrsetarg8(work, sizeof(work), (BYTE *)p->value, p->size);
				break;

			case INITYPE_SINT8:
				SPRINTF(work, str_d, *((char *)p->value));
				break;

			case INITYPE_SINT16:
				SPRINTF(work, str_d, *((SINT16 *)p->value));
				break;

			case INITYPE_SINT32:
				SPRINTF(work, str_d, *((SINT32 *)p->value));
				break;

			case INITYPE_UINT8:
				SPRINTF(work, str_u, *((BYTE *)p->value));
				break;

			case INITYPE_UINT16:
				SPRINTF(work, str_u, *((UINT16 *)p->value));
				break;

			case INITYPE_UINT32:
				SPRINTF(work, str_u, *((UINT32 *)p->value));
				break;

			case INITYPE_HEX8:
				SPRINTF(work, str_x, *((BYTE *)p->value));
				break;

			case INITYPE_HEX16:
				SPRINTF(work, str_x, *((UINT16 *)p->value));
				break;

			case INITYPE_HEX32:
				SPRINTF(work, str_x, *((UINT32 *)p->value));
				break;

			default:
				set = FAILURE;
				break;
		}
		if (set == SUCCESS) {
			file_write(fh, p->item, strlen(p->item));
			file_write(fh, "=", 1);
			file_write(fh, work, strlen(work));
			file_write(fh, "\r\n", 2);
		}
		p++;
	}
	file_close(fh);
}
예제 #26
0
파일: np2info.c 프로젝트: histat/dc-np2
static void info_gdc(OEMCHAR *str, int maxlen, const NP2INFOEX *ex) {

	milstr_ncpy(str, milstr_list(str_grcgchip, grcg.chip & 3), maxlen);
	milstr_ncat(str, str_2halfMHz + ((gdc.clock & 0x80)?2:0), maxlen);
	(void)ex;
}
예제 #27
0
파일: moviemng.c 프로젝트: nonakap/xkazoku
void
moviemng_play(const char *fname, SCRN_T *scrn)
{
	static const char ext[][5] = { "", ".AVI", ".MPG", ".avi", ".mpg" };
	char movie_file[MAX_PATH] = "";
	char path[MAX_PATH];
	struct stat st;
	SDL_SysWMinfo info;
	ARCFILEH arch;
	int i;

	UNUSED(scrn);

	if (!nomovie_flag)
		return;

	memset(&info, 0, sizeof(info));
	info.version.major = SDL_MAJOR_VERSION;
	info.version.minor = SDL_MINOR_VERSION;
	if (SDL_GetWMInfo(&info) <= 0)
		return;

	/*
	 * 1. とりあえずデータディレクトリから検索
	 */
	for (i = 0; i < NELEMENTS(ext); ++i) {
		milstr_ncpy(path, gamecore.suf.scriptpath, sizeof(path));
		milstr_ncat(path, fname, sizeof(path));
		cutExtName(path);
		milstr_ncat(path, ext[i], sizeof(path));

		if (stat(path, &st) < 0)
			continue;
		if (st.st_mode & S_IFDIR)
			continue;
		if (access(path, R_OK) < 0)
			continue;

		/* OK */
		goto run;
	}

	/*
	 * 2. アーカイブ内に存在するか確認
	 *    (こんなあったら嫌だなぁ…)
	 */
	for (arch = NULL, i = 0; i < ARCTYPES; ++i) {
		arch = arcfile_open(i, fname);
		if (arch)
			break;
	}
	if (arch) {
		int fd;
		char *buf;

		sprintf(path, "/tmp/." APP_NAME "-%s-XXXXXXX", fname);
#if defined(HAVE_MKSTEMP) || defined(__NetBSD__)
		fd = mkstemp(path);
#else
		mktemp(path);
		fd = open(path, O_RDWR | O_CREAT | O_TRUNC, 0600);
#endif
		if (fd >= 0) {
			buf = (char *)_MALLOC(arch->size, "movie temp file");
			arcfile_seek(arch, arch->pos, SEEK_SET);
			if (arcfile_read(arch, buf, arch->size) == arch->size) {
				write(fd, buf, arch->size);
				close(fd);
				_MFREE(buf);
				milstr_ncpy(movie_file,path,sizeof(movie_file));
				goto run;
			}
			close(fd);
			_MFREE(buf);
		}
	}
	return;

run:
	inputmng_resetmouse(0);
	sound_term();

	info.info.x11.lock_func();
	movie_play(path);
	info.info.x11.unlock_func();

	if (movie_file[0] != '\0') {
		unlink(movie_file);
	}

	sound_init(audio_rate);
	sound_play();
}
예제 #28
0
파일: vramdraw.c 프로젝트: nonakap/xkazoku
void vramdraw_savebmp(int num, const char *dir, const char *name,
						int pos, const char *credit0, const char *credit1) {

	int		i;
	char	path[MAX_PATH];
	char	work[32];
	BMPDATA	inf;
	VRAMHDL	vram;
	UINT	tmp;
	UINT	bmpsize;
	BMPFILE	bf;
	BMPINFO	bi;
	BYTE	*dat;
	FILEH	fh;

	if ((num < 0) || (num >= GAMECORE_MAXVRAM) || (name == NULL)) {
		goto vdsb_err1;
	}
	if (dir == NULL) {
		dir = "";
	}
	for (i=0; i<100; i++) {
		milstr_ncpy(path, dir, sizeof(path));
		milstr_ncat(path, name, sizeof(path));
		sprintf(work, "%02u.bmp", i);
		milstr_ncat(path, work, sizeof(path));
		if (file_attr(path) == -1) {
			break;
		}
		taskmng_rol();
	}
	if (i >= 100) {
		goto vdsb_err1;
	}

	vram = vram_copy(gamecore.vram[num]);
	if (vram == NULL) {
		goto vdsb_err1;
	}
	creditmix(vram, pos, credit1, 0x000000);
	creditmix(vram, pos, credit0, 0xffffff);

	inf.width = vram->width;
	inf.height = vram->height;
	inf.bpp = 24;

	bmpdata_setinfo(&bi, &inf, TRUE);
	bmpsize = bmpdata_getdatasize(&bi);

	ZeroMemory(&bf, sizeof(bf));
	bf.bfType[0] = 'B';
	bf.bfType[1] = 'M';
	tmp = sizeof(BMPFILE) + sizeof(BMPINFO);
	STOREINTELDWORD(bf.bfOffBits, tmp);
	tmp += bmpsize;
	STOREINTELDWORD(bf.bfSize, tmp);

	dat = bmpdata_bmp24cnv(&bi, vram);
	if (dat == NULL) {
		goto vdsb_err2;
	}
	fh = file_create(path);
	if (fh == FILEH_INVALID) {
		goto vdsb_err3;
	}
	file_write(fh, &bf, sizeof(bf));
	file_write(fh, &bi, sizeof(bi));
	file_write(fh, dat, bmpsize);
	file_close(fh);

vdsb_err3:
	_MFREE(dat);

vdsb_err2:
	vram_destroy(vram);

vdsb_err1:
	return;
}
예제 #29
0
파일: saveisf.c 프로젝트: nonakap/xkazoku
static FILEH saveopen(SAVEISF isf, BOOL create) {

	FILEH	fh;
	char	path[MAX_PATH];
	BOOL	r;

	milstr_ncpy(path, gamecore.suf.scriptpath, sizeof(path));

	if (!(gamecore.sys.type & GAME_SAVEALIAS)) {
		switch(gamecore.sys.version) {
			case EXEVER_MYU:
			case EXEVER_AMEIRO:
			case EXEVER_NURSE:
			case EXEVER_VECHO:
				milstr_ncat(path, "GAME.SAV", sizeof(path));
				break;

			case EXEVER_TSUKU:
				milstr_ncat(path, "TSUKU.SAV", sizeof(path));
				break;

			default:
				milstr_ncat(path, gamecore.suf.key, sizeof(path));
				milstr_ncat(path, ".SAV", sizeof(path));
				break;
		}
	}
	else {
		milstr_ncat(path, "xkazoku.sav", sizeof(path));
	}
	TRACEOUT(("savefile: %s", path));
	if (!create) {
		fh = file_open_rb(path);
	}
	else {
		fh = file_open(path);
	}
	if (fh != FILEH_INVALID) {
		if (isf->savever == 2) {
			BYTE work[8];
			if (file_read(fh, work, 8) == 8) {
				isf->headsize = LOADINTELDWORD(work+0);
				isf->files = LOADINTELDWORD(work+4);
			}
			file_seek(fh, 0, FSEEK_SET);
		}
	}
	else if (create) {
		fh = file_create(path);
		if (fh != FILEH_INVALID) {
			if (isf->savever == 0) {
				r = savezerofill(fh, savegetinitsize(isf));
			}
			else if (isf->savever == 1) {
				r = savezerofill(fh, isf->headsize);
			}
			else {
				r = savever2header(fh, isf);
			}
			if (r != SUCCESS) {
				file_close(fh);
				fh = FILEH_INVALID;
				file_delete(path);
			}
		}
	}
	return(fh);
}
예제 #30
0
파일: cpu.c 프로젝트: FREEWING-JP/np2pi
void
exec_1step(void)
{
	int prefix;
	UINT32 op;

	CPU_PREV_EIP = CPU_EIP;
	CPU_STATSAVE.cpu_inst = CPU_STATSAVE.cpu_inst_default;

#if defined(ENABLE_TRAP)
	steptrap(CPU_CS, CPU_EIP);
#endif

#if defined(IA32_INSTRUCTION_TRACE)
	ctx[ctx_index].regs = CPU_STATSAVE.cpu_regs;
	if (cpu_inst_trace) {
		disasm_context_t *d = &ctx[ctx_index].disasm;
		UINT32 eip = CPU_EIP;
		int rv;

		rv = disasm(&eip, d);
		if (rv == 0) {
			char buf[256];
			char tmp[32];
			int len = d->nopbytes > 8 ? 8 : d->nopbytes;
			int i;

			buf[0] = '\0';
			for (i = 0; i < len; i++) {
				snprintf(tmp, sizeof(tmp), "%02x ", d->opbyte[i]);
				milstr_ncat(buf, tmp, sizeof(buf));
			}
			for (; i < 8; i++) {
				milstr_ncat(buf, "   ", sizeof(buf));
			}
			VERBOSE(("%04x:%08x: %s%s", CPU_CS, CPU_EIP, buf, d->str));

			buf[0] = '\0';
			for (; i < d->nopbytes; i++) {
				snprintf(tmp, sizeof(tmp), "%02x ", d->opbyte[i]);
				milstr_ncat(buf, tmp, sizeof(buf));
				if ((i % 8) == 7) {
					VERBOSE(("             : %s", buf));
					buf[0] = '\0';
				}
			}
			if ((i % 8) != 0) {
				VERBOSE(("             : %s", buf));
			}
		}
	}
	ctx[ctx_index].opbytes = 0;
#endif

	for (prefix = 0; prefix < MAX_PREFIX; prefix++) {
		GET_PCBYTE(op);
#if defined(IA32_INSTRUCTION_TRACE)
		ctx[ctx_index].op[prefix] = op;
		ctx[ctx_index].opbytes++;
#endif

		/* prefix */
		if (insttable_info[op] & INST_PREFIX) {
			(*insttable_1byte[0][op])();
			continue;
		}
		break;
	}
	if (prefix == MAX_PREFIX) {
		EXCEPTION(UD_EXCEPTION, 0);
	}

#if defined(IA32_INSTRUCTION_TRACE)
	if (op == 0x0f) {
		BYTE op2;
		op2 = cpu_codefetch(CPU_EIP);
		ctx[ctx_index].op[prefix + 1] = op2;
		ctx[ctx_index].opbytes++;
	}
	ctx_index = (ctx_index + 1) % NELEMENTS(ctx);
#endif

	/* normal / rep, but not use */
	if (!(insttable_info[op] & INST_STRING) || !CPU_INST_REPUSE) {
#if defined(DEBUG)
		cpu_debug_rep_cont = 0;
#endif
		(*insttable_1byte[CPU_INST_OP32][op])();
		return;
	}

	/* rep */
	CPU_WORKCLOCK(5);
#if defined(DEBUG)
	if (!cpu_debug_rep_cont) {
		cpu_debug_rep_cont = 1;
		cpu_debug_rep_regs = CPU_STATSAVE.cpu_regs;
	}
#endif
	if (!CPU_INST_AS32) {
		if (CPU_CX != 0) {
			if (!(insttable_info[op] & REP_CHECKZF)) {
				/* rep */
				for (;;) {
					(*insttable_1byte[CPU_INST_OP32][op])();
					if (--CPU_CX == 0) {
#if defined(DEBUG)
						cpu_debug_rep_cont = 0;
#endif
						break;
					}
					if (CPU_REMCLOCK <= 0) {
						CPU_EIP = CPU_PREV_EIP;
						break;
					}
				}
			} else if (CPU_INST_REPUSE != 0xf2) {
				/* repe */
				for (;;) {
					(*insttable_1byte[CPU_INST_OP32][op])();
					if (--CPU_CX == 0 || CC_NZ) {
#if defined(DEBUG)
						cpu_debug_rep_cont = 0;
#endif
						break;
					}
					if (CPU_REMCLOCK <= 0) {
						CPU_EIP = CPU_PREV_EIP;
						break;
					}
				}
			} else {
				/* repne */
				for (;;) {
					(*insttable_1byte[CPU_INST_OP32][op])();
					if (--CPU_CX == 0 || CC_Z) {
#if defined(DEBUG)
						cpu_debug_rep_cont = 0;
#endif
						break;
					}
					if (CPU_REMCLOCK <= 0) {
						CPU_EIP = CPU_PREV_EIP;
						break;
					}
				}
			}
		}
	} else {
		if (CPU_ECX != 0) {
			if (!(insttable_info[op] & REP_CHECKZF)) {
				/* rep */
				for (;;) {
					(*insttable_1byte[CPU_INST_OP32][op])();
					if (--CPU_ECX == 0) {
#if defined(DEBUG)
						cpu_debug_rep_cont = 0;
#endif
						break;
					}
					if (CPU_REMCLOCK <= 0) {
						CPU_EIP = CPU_PREV_EIP;
						break;
					}
				}
			} else if (CPU_INST_REPUSE != 0xf2) {
				/* repe */
				for (;;) {
					(*insttable_1byte[CPU_INST_OP32][op])();
					if (--CPU_ECX == 0 || CC_NZ) {
#if defined(DEBUG)
						cpu_debug_rep_cont = 0;
#endif
						break;
					}
					if (CPU_REMCLOCK <= 0) {
						CPU_EIP = CPU_PREV_EIP;
						break;
					}
				}
			} else {
				/* repne */
				for (;;) {
					(*insttable_1byte[CPU_INST_OP32][op])();
					if (--CPU_ECX == 0 || CC_Z) {
#if defined(DEBUG)
						cpu_debug_rep_cont = 0;
#endif
						break;
					}
					if (CPU_REMCLOCK <= 0) {
						CPU_EIP = CPU_PREV_EIP;
						break;
					}
				}
			}
		}
	}
}