#if 0-ed GTK/X11 codes, add codes for Playstation Portable

This commit is contained in:
hissorii 2013-08-02 10:30:19 +09:00
parent e0ca3751d2
commit d94822fe58
19 changed files with 417 additions and 36 deletions

View File

@ -1087,7 +1087,7 @@ GTK_LIB= `$(GTK_CONFIG) --libs`
# SDL 1.2
SDL_CONFIG?= sdl-config
SDL_INCLUDE= `$(SDL_CONFIG) --cflags`
SDL_LIB= `$(SDL_CONFIG) --libs`
SDL_LIB= `$(SDL_CONFIG) --libs` -lSDL_gfx
NASM?= nasm
NASMFLAGS= -i ./x68k -i ./x11

79
Makefile.psp Normal file
View File

@ -0,0 +1,79 @@
#if defined(NO_SOUND)
EXTRA_DEFINES+= -DNOSOUND
#endif
#if defined(NO_MERCURY)
EXTRA_DEFINES+= -DNO_MERCURY
#endif
EXTRA_INCLUDES= -I./x11 -I./x68k -I./fmgen -I./win32api \
$(GTK_INCLUDE) $(SDL_INCLUDE)
CXXEXTRA_INCLUDES= $(EXTRA_INCLUDES)
CXXEXTRA_DEFINES= $(EXTRA_DEFINES)
CXXDEBUGFLAGS= $(CDEBUGFLAGS)
LOCAL_LIBRARIES= $(XLIB) $(GTK_LIB) $(SDL_LIB)
#define PassCDebugFlags
CPUOBJS= x68k/d68k.o m68000/c68k.o m68000/m68000.o
X68KOBJS= \
x68k/adpcm.o x68k/bg.o x68k/crtc.o x68k/dmac.o x68k/fdc.o \
x68k/fdd.o x68k/disk_d88.o x68k/disk_dim.o x68k/disk_xdf.o \
x68k/gvram.o x68k/ioc.o x68k/irqh.o x68k/mem_wrap.o x68k/mercury.o \
x68k/mfp.o x68k/palette.o x68k/midi.o x68k/pia.o x68k/rtc.o \
x68k/sasi.o x68k/scc.o x68k/scsi.o x68k/sram.o x68k/sysport.o \
x68k/tvram.o \
x68k/cpu_glue.o
FMGENOBJS= \
fmgen/fmgen.o fmgen/fmg_wrap.o fmgen/file.o fmgen/fmtimer.o \
fmgen/opm.o fmgen/opna.o fmgen/psg.o
X11OBJS= \
x11/joystick.o x11/juliet.o x11/keyboard.o x11/mouse.o x11/prop.o \
x11/status.o x11/timer.o \
x11/dswin.o x11/windraw.o x11/winui.o \
x11/about.o
X11CXXOBJS= x11/winx68k.o
WIN32APIOBJS= win32api/dosio.o win32api/fake.o win32api/peace.o
COBJS= $(X68KOBJS) $(X11OBJS) $(WIN32APIOBJS) $(CPUOBJS)
CXXOBJS= $(FMGENOBJS) $(X11CXXOBJS)
OBJS= $(COBJS) $(CXXOBJS)
TARGET = px68k
#OBJS = cube.o logo.o ../common/callbacks.o ../common/vram.o
# for psplink
#BUILD_PRX = 1
PSPDEV = $(shell psp-config -d)
PSPBIN = $(PSPDEV)/psp/bin
SDL_CONFIG = $(PSPBIN)/sdl-config
SDL_INCLUDE= `$(SDL_CONFIG) --cflags`
SDL_LIB= `$(SDL_CONFIG) --libs`
INCDIR = ./x11 ./x68k ./fmgen ./win32api
#CFLAGS = -G0 -Wall $(SDL_INCLUDE)
# for debugging
CFLAGS = -g -G0 -Wall $(SDL_INCLUDE)
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
LIBDIR =
LDFLAGS =
LIBS= -lpspgum -lpspgu -lm -lstdc++ $(SDL_LIB)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = PX68K for PSP
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
logo.o: logo.raw
bin2o -i logo.raw logo.o logo

View File

@ -192,3 +192,7 @@ spline_%1_ed:
-> done
** 2013/07/30
* gtk/x11関連のソースをなくす

View File

@ -1,13 +1,69 @@
PX68K ( Portable (x)keropi PRO-68K )
ひっそりぃ(hissorii)/sakahi
ポータブルX68000エミュレータ
PX68K ( Portable (x)keropi PRO-68K ) Ver.0.00
2013/08/02
けんじょさん (http://retropc.net/kenjo/) が作成された SHARP X68000
エミュレータ WinX68k (通称けろぴー)を、NONAKA Kimihiro さんが
UNIX/X11 環境で動作する様に移植した xkeropi
(http://www.asahi-net.or.jp/~aw9k-nnk/keropi/) を公開されています。
けんじょさん (http://retropc.net/kenjo/) が
作成された SHARP X68000エミュレータ WinX68k (通称けろぴー)を、
NONAKA Kimihiro さん(http://www.asahi-net.or.jp/~aw9k-nnk/keropi/) が
UNIX/X11 環境で動作する様に移植した xkeropi を
公開されています。
その xkeropi をベースにして、より移植性(portability)を高めるべく
開発中なのがPX68Kです。
開発中なのがPX68Kなのです。
つづく
とりあえずGTK/X11用に作られていたメニューやらキー入力やらは
全部取っ払ったので、今のところそれらはないです。
0. 下準備
0.1 UNIX系の場合
・xkeropiと同じ。
0.2 PSPの場合
・EBOOT.PBPと同じディレクトリに.keropiというディレクトリを作成し、
BIOS ROM, フォントファイルを置く。
1. FDイメージの指定法
1.1 UNIX系の場合
・引数で指定します。最初がFDD1, 次がFDD2。
$ ./xkeropi hoge.xdf hogege.xdf
1.2 PSPの場合
・FDD一枚目として読み込みたいイメージファイルをFDD1.XDFとして、
EBOOT.PBPと同じディレクトリに置く。
FDD二枚目の場合はFDD2.XDFとして置く。
3. その他
3.1 X68000のメインメモリ
・現在2MBにしています。
3.1 メモリ1MBしか認識していないようですが?
・HUMAN68KのSWITCH.Xで指定するのですが、PSPでは現在キーボード入力が
できません。他のエミュレーターで実行して、sram.datを持ってくれば
うまくいくかも。
3.3 PSPで実行すると画面がはみ出たりするんですが?
3.4 PSPで実行するとキー入力できないのですが?
3.5 PSPで実行すると動作がものすごく遅いんですけど?
3.6 音が出ないのですが?
3.7 説明の番号が1から3に飛んでるんですけど?
-> とりあえず現状はそんなものです。すみません。
ひっそりぃ(hissorii)/sakahi
http://hissorii.blog45.fc2.com ひっそりぃドットコム
http://emuhani.seesaa.net えみゅはに - Emulator Hacking 日記
GitHub: https://github.com/hissorii/px68k
Twitter: @hissorii_com

View File

@ -159,7 +159,7 @@ void fname_mix(LPSTR str, LPSTR mix, int size);
#define DD_YEAR_MASK 0xFE00 /* year - 1980 */
#define DD_YEAR_SHIFT 9
void unix2dostime(time_t t, u_int16_t *ddp, u_int16_t *dtp, u_int8_t *dhp);
void unix2dostime(time_t t, unsigned short *ddp, unsigned short *dtp, unsigned char *dhp);
void dos2unixtime(u_int dd, u_int dt, u_int dh, time_t *tp);
#ifdef __cplusplus

View File

@ -33,14 +33,18 @@
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#if 0
#include <sys/uio.h>
#endif
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#if 0
#include <X11/Xlib.h>
#endif
#include "windows.h"
#include "mmsystem.h"

View File

@ -30,7 +30,9 @@
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#if 0
#include <sys/uio.h>
#endif
#include <fcntl.h>
#include <stdio.h>
@ -295,7 +297,7 @@ GlobalAlloc(UINT flags, DWORD bytes)
p->psize = bytes;
p->refcount = 0;
p->type = HTYPE_MEMORY;
return p;
return p->p;
}
return 0;
}

View File

@ -37,6 +37,7 @@
#include "../icons/nekolgc.xpm"
#include "../icons/opm.xpm"
#if 0
static void
dialog_destroy(GtkWidget *w, GtkWidget **wp)
{
@ -150,3 +151,4 @@ create_about_dialog(void)
gtk_widget_show(table);
gtk_widget_show(dialog);
}
#endif

View File

@ -28,6 +28,8 @@
#ifndef about_h__
#define about_h__
#if 0
void create_about_dialog(void);
#endif
#endif /* about_h__ */

View File

@ -15,6 +15,13 @@
#define LABEL
#define __stdcall
#ifdef PSP
#ifdef MAX_PATH
#undef MAX_PATH
#endif
#define MAX_PATH 256
#endif
typedef unsigned char UINT8;
typedef unsigned short UINT16;
typedef unsigned int UINT32;

View File

@ -57,7 +57,9 @@ Keyboard_Init(void)
// ¤ĆĄź¤Ö¤ëÎŕ
// ----------------------------------
#if 0
#include <gdk/gdkkeysyms.h>
#endif
#define NC 0
@ -336,6 +338,7 @@ BYTE KeyTableMaster[512] = {
void
Keyboard_KeyDown(DWORD wp)
{
#if 0
BYTE code;
BYTE newwp;
@ -394,6 +397,7 @@ Keyboard_KeyDown(DWORD wp)
JoyKeyState |= JOY_TRG2;
break;
}
#endif
}
// ----------------------------------
@ -402,6 +406,7 @@ Keyboard_KeyDown(DWORD wp)
void
Keyboard_KeyUp(DWORD wp)
{
#if 0
BYTE code;
BYTE newwp;
@ -456,6 +461,7 @@ Keyboard_KeyUp(DWORD wp)
JoyKeyState &= ~JOY_TRG2;
break;
}
#endif
}
// ----------------------------------

View File

@ -40,14 +40,17 @@ BYTE MouseSW = 0;
POINT CursorPos;
int mousex = 0, mousey = 0;
#if 0
static GdkPixmap *cursor_pixmap;
static GdkCursor *cursor;
static void getmaincenter(GtkWidget *w, POINT *p);
void gdk_window_set_pointer(GdkWindow *window, gint x, gint y);
#endif
void Mouse_Init(void)
{
#if 0
static gchar hide_cursor[16*16/8] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -70,6 +73,7 @@ void Mouse_Init(void)
MousePosX = (TextDotX / 2);
MousePosY = (TextDotY / 2);
MouseStat = 0;
#endif
}
@ -78,7 +82,7 @@ void Mouse_Init(void)
// ----------------------------------
void Mouse_Event(DWORD wparam, DWORD lparam)
{
#if 0
if (MouseSW) {
switch (wparam) {
case 0: // ¥Þ¥¦¥¹°ÜÆ°
@ -104,6 +108,7 @@ void Mouse_Event(DWORD wparam, DWORD lparam)
break;
}
}
#endif
}
@ -112,6 +117,7 @@ void Mouse_Event(DWORD wparam, DWORD lparam)
// ----------------------------------
void Mouse_SetData(void)
{
#if 0
POINT pt;
int x, y;
@ -152,6 +158,7 @@ void Mouse_SetData(void)
MouseX = 0;
MouseY = 0;
}
#endif
}
@ -160,6 +167,7 @@ void Mouse_SetData(void)
// ----------------------------------
void Mouse_StartCapture(int flag)
{
#if 0
GtkWidget *w = window;
POINT pt;
@ -182,20 +190,23 @@ void Mouse_StartCapture(int flag)
MouseSW = 0;
}
#endif
}
void Mouse_ChangePos(void)
{
#if 0
if (MouseSW) {
POINT pt;
getmaincenter(window, &pt);
gdk_window_set_pointer(window->window, pt.x, pt.y);
}
#endif
}
#if 0
static void
getmaincenter(GtkWidget *w, POINT *p)
{
@ -241,3 +252,4 @@ gdk_window_set_pointer(GdkWindow *window, gint x, gint y)
0, 0, 0, 0, x, y);
}
#endif /* GTK_MAJOR_VERSION == 1 */
#endif

View File

@ -143,7 +143,7 @@ set_modulepath(char *path, size_t len)
if (homepath == 0)
homepath = ".";
g_snprintf(path, len, "%s/%s", homepath, ".keropi");
snprintf(path, len, "%s/%s", homepath, ".keropi");
if (stat(path, &sb) < 0) {
if (mkdir(path, 0700) < 0) {
perror(path);
@ -155,7 +155,7 @@ set_modulepath(char *path, size_t len)
return 1;
}
}
g_snprintf(winx68k_ini, sizeof(winx68k_ini), "%s/%s", path, "config");
snprintf(winx68k_ini, sizeof(winx68k_ini), "%s/%s", path, "config");
if (stat(winx68k_ini, &sb) >= 0) {
if (sb.st_mode & S_IFDIR) {
fprintf(stderr, "%s is directory.\n", winx68k_ini);
@ -385,6 +385,7 @@ void SaveConfig(void)
/* --------------- */
#if 0
typedef struct {
GtkWidget *fs;
int type;
@ -1292,3 +1293,4 @@ file_selection(int type, char *title, char *defstr, void *arg)
gtk_widget_show(file_dialog);
}
#endif

View File

@ -26,6 +26,7 @@
*/
#include <SDL.h>
//#include <SDL_rotozoom.h>
#include "common.h"
#include "winx68k.h"
#include "winui.h"
@ -44,6 +45,7 @@
extern BYTE Debug_Text, Debug_Grp, Debug_Sp;
WORD *ScrBuf = 0;
SDL_Surface *sdl_rgbsurface;
int Draw_Opaque;
int FullScreenFlag = 0;
@ -65,6 +67,7 @@ WORD WinDraw_Pal16B, WinDraw_Pal16R, WinDraw_Pal16G;
DWORD WindowX = 0;
DWORD WindowY = 0;
#if 0
GdkImage *surface;
GdkRectangle surface_rect = { 16, 16, FULLSCREEN_WIDTH, FULLSCREEN_HEIGHT };
GdkImage *scaled_screen;
@ -74,22 +77,26 @@ static int screen_mode;
GdkImage *gdk_scale_image(GdkImage *dest, GdkImage *src, GdkRectangle *dest_rect, GdkRectangle *src_rect);
#endif
void WinDraw_InitWindowSize(WORD width, WORD height)
{
static BOOL inited = FALSE;
if (!inited) {
#if 0
GdkWindow *t, *root = window->window;
while ((t = gdk_window_get_parent(root)) != 0)
root = t;
gdk_window_get_size(root, &root_width, &root_height);
#endif
inited = TRUE;
}
#if 0
gdk_window_get_position(window->window, &winx, &winy);
#endif
winw = width;
winh = height;
@ -167,21 +174,30 @@ void WinDraw_ChangeSize(void)
WindowY = oldy = 512;
}
#if 0
surface_rect.width = TextDotX;
surface_rect.height = TextDotY;
#endif
if ((oldx == WindowX) && (oldy == WindowY))
return;
#if 0
if ((TextDotX == WindowX) && (TextDotY == WindowY))
screen_mode = 0;
else {
screen_mode = 1;
#endif
#if 0
if (scaled_screen)
gdk_image_destroy(scaled_screen);
scaled_screen = gdk_image_new(GDK_IMAGE_FASTEST,
surface->visual, WindowX, WindowY);
}
#endif
#if 0
if (surface) {
bzero(ScrBuf, FULLSCREEN_WIDTH * FULLSCREEN_HEIGHT * 2);
#if 1
@ -194,10 +210,13 @@ void WinDraw_ChangeSize(void)
0, oldy, FULLSCREEN_WIDTH - oldx, FULLSCREEN_HEIGHT - oldy);
#endif
}
#endif
WinDraw_InitWindowSize((WORD)WindowX, (WORD)WindowY);
#if 0
gtk_widget_set_usize(drawarea, winw, winh);
gtk_widget_set_uposition(window, winx, winy);
#endif
StatBar_Show(Config.WindowFDDStat);
Mouse_ChangePos();
}
@ -220,38 +239,45 @@ void WinDraw_ChangeMode(int flag)
void WinDraw_ShowSplash(void)
{
#if 0
gdk_draw_pixmap(pixmap,
drawarea->style->fg_gc[GTK_WIDGET_STATE(drawarea)],
splash_pixmap, 0, 0,
768 - keropi_xpm_width, 512 - keropi_xpm_height,
keropi_xpm_width, keropi_xpm_height);
#endif
}
void WinDraw_HideSplash(void)
{
#if 0
gdk_draw_rectangle(pixmap, window->style->black_gc, TRUE, 0, 0,
FULLSCREEN_WIDTH, FULLSCREEN_HEIGHT);
Draw_DrawFlag = 1;
#endif
}
int WinDraw_Init(void)
{
#if 0
GdkVisual *visual;
GdkColormap *colormap;
GdkBitmap *mask;
#endif
SDL_Surface *sdl_surface;
WindowX = 768;
WindowY = 512;
#if 0
if ((root_width < WindowX) || (root_height < WindowY)) {
fprintf(stderr, "No support resolution.\n");
return FALSE;
}
#endif
#if 0
visual = gtk_widget_get_visual(drawarea);
switch (visual->type) {
@ -265,10 +291,11 @@ int WinDraw_Init(void)
fprintf(stderr, "No support visual class.\n");
return FALSE;
}
#endif
sdl_surface = SDL_GetVideoSurface();
if (sdl_surface == NULL) {
g_message("can't create surface.");
fprintf(stderr, "can't create surface.\n");
return 1;
}
@ -276,9 +303,18 @@ int WinDraw_Init(void)
WinDraw_Pal16G = sdl_surface->format->Gmask;
WinDraw_Pal16B = sdl_surface->format->Bmask;
ScrBuf = (WORD *)sdl_surface->pixels;
// ScrBuf = (WORD *)sdl_surface->pixels;
sdl_rgbsurface = SDL_CreateRGBSurface(SDL_SWSURFACE, 800, 512, 16, sdl_surface->format->Rmask, sdl_surface->format->Gmask, sdl_surface->format->Bmask, sdl_surface->format->Amask);
SDL_LockSurface(sdl_surface);
if (sdl_rgbsurface == 0) {
puts("ScrBuf allocate failed");
exit(1);
}
ScrBuf = sdl_rgbsurface->pixels;
printf("drawbuf: 0x%x, ScrBuf: 0x%x\n", sdl_surface->pixels, ScrBuf);
SDL_LockSurface(sdl_rgbsurface);
{
// printf("hoge\n");
int i;
@ -286,8 +322,9 @@ int WinDraw_Init(void)
*(ScrBuf + i) = 0xffff;
}
}
SDL_UnlockSurface(sdl_surface);
SDL_UnlockSurface(sdl_rgbsurface);
#if 0
pixmap = gdk_pixmap_new(drawarea->window,
FULLSCREEN_WIDTH, FULLSCREEN_HEIGHT, visual->depth);
if (pixmap == NULL) {
@ -296,13 +333,16 @@ int WinDraw_Init(void)
}
gdk_draw_rectangle(pixmap, window->style->black_gc, TRUE, 0, 0,
FULLSCREEN_WIDTH, FULLSCREEN_HEIGHT);
#endif
#if 0
/* けろぴーすぷらっしゅ用意 */
colormap = gtk_widget_get_colormap(window);
splash_pixmap = gdk_pixmap_colormap_create_from_xpm_d(NULL, colormap,
&mask, NULL, keropi_xpm);
if (splash_pixmap == NULL)
g_error("Couldn't create replacement pixmap.");
#endif
return TRUE;
}
@ -310,7 +350,7 @@ int WinDraw_Init(void)
void
WinDraw_Cleanup(void)
{
#if 0
if (splash_pixmap) {
gdk_pixmap_unref(splash_pixmap);
splash_pixmap = 0;
@ -329,6 +369,7 @@ WinDraw_Cleanup(void)
ScrBuf = 0;
}
gdk_window_get_position(window->window, &winx, &winy);
#endif
}
void
@ -341,21 +382,92 @@ WinDraw_Redraw(void)
void FASTCALL
WinDraw_Draw(void)
{
SDL_Surface *sdl_surface;
sdl_surface = SDL_GetVideoSurface();
SDL_UpdateRect(sdl_surface, 0, 0, FULLSCREEN_WIDTH, FULLSCREEN_HEIGHT);
SDL_Surface *sdl_surface, *roto_surface;
SDL_Rect srcrect, dstrect;
int ret;
#if 0 // PSPだとうまく動かない
roto_surface = rotozoomSurfaceXY(sdl_rgbsurface, 0, 0.3, 0.3, 0);
if (roto_surface == NULL) {
puts("rotozoom failed");
}
srcrect.x = srcrect.y = 200;
srcrect.w = 480, srcrect.h = 272;
dstrect.x = dstrect.y = 0;
dstrect.w = 480, dstrect.h = 272;
if (sdl_rgbsurface == NULL) {
puts("xxx sdl_rgbsurface not allocated yet");
return;
}
sdl_surface = SDL_GetVideoSurface();
if (sdl_surface == NULL) {
puts("xxx sdl_sururface not allocated yet");
return;
}
ret = SDL_BlitSurface(roto_surface, NULL, sdl_surface, NULL);
if (ret < 0) {
printf("SDL_BlitSurface() failed %d\n", ret);
}
#else
int x, y;
DWORD c, *p, *p2, *dst, dummy;
sdl_surface = SDL_GetVideoSurface();
#ifdef PSP
#if 0 //縦横1/2拡大。未完成
p = ScrBuf;
p2 = ScrBuf + 800;
for (y = 0; y < 512 / 2; y += 2) {
dst = (DWORD *)(sdl_surface->pixels + 512 * 4 * y / 2);
p = ScrBuf + 800 * y;
p2 = p + 800;
for (x = 0; x < 800; x += 2) {
*dst++ = (*p++ + *p++ + *p2++ + *p2++) / 4;
// dummy = (*p++ + *p++ + *p2++ + *p2++) / 4;
}
}
#else // とりあえず指定範囲内のみblit
// PSPのsdl_surfaceのバッファは幅512
p = ScrBuf;
dst = sdl_surface->pixels;
for (y = 0; y < 272; y++) {
p = ScrBuf + 800 * y;
// surface->pixelsはvoid *
dst = sdl_surface->pixels + 512 * 2 * y;
for (x = 0; x < 480; x++) {
*dst++ = *p++;
}
}
#endif
#else
ret = SDL_BlitSurface(sdl_rgbsurface, NULL, sdl_surface, NULL);
if (ret < 0) {
printf("SDL_BlitSurface() failed %d\n", ret);
}
#endif
#endif
#ifdef PSP
SDL_UpdateRect(sdl_surface, 0, 0, 480, 272);
#else
SDL_UpdateRect(sdl_surface, 0, 0, FULLSCREEN_WIDTH, FULLSCREEN_HEIGHT);
#endif
#if 0
GtkWidget *w = (GtkWidget *)drawarea;
GdkDrawable *d = (GdkDrawable *)drawarea->window;
#endif
FrameCount++;
if (!Draw_DrawFlag && is_installed_idle_process())
if (!Draw_DrawFlag/* && is_installed_idle_process()*/)
return;
Draw_DrawFlag = 0;
if (SplashFlag)
WinDraw_ShowSplash();
#if 0
if (screen_mode == 0) {
gdk_draw_pixmap(d, w->style->fg_gc[GTK_WIDGET_STATE(w)],
pixmap, 0, 0, 0, 0, TextDotX, TextDotY);
@ -366,6 +478,7 @@ WinDraw_Draw(void)
scaled_screen, 0, 0, 0, 0, WindowX, WindowY);
#endif
}
#endif
}
INLINE void WinDraw_DrawGrpLine(int opaq)
@ -2273,15 +2386,15 @@ void WinDraw_DrawLine(void)
#endif /* USE_ASM */
}
#if 0
switch (screen_mode) {
case 0:
#if 0
gdk_draw_image(pixmap,
drawarea->style->fg_gc[GTK_WIDGET_STATE(drawarea)],
surface, 16, 16 + VLINE, 0, VLINE, WindowX, 1);
#endif
break;
}
#endif
}
@ -2345,6 +2458,7 @@ gcd(unsigned int v0, unsigned int v1)
#endif
}
#if 0
static void expand16_fast(GdkImage *dest, GdkImage *src, GdkRectangle *dr, GdkRectangle *sr, int ratio[4]);
GdkImage *
@ -2447,3 +2561,4 @@ expand16_fast(GdkImage *dest, GdkImage *src, GdkRectangle *dr, GdkRectangle *sr,
}
}
}
#endif

View File

@ -93,6 +93,7 @@ extern int dmatrace;
DWORD LastClock[4] = {0, 0, 0, 0};
#if 0
#define EVENT_MASK \
(GDK_BUTTON1_MOTION_MASK \
| GDK_BUTTON2_MOTION_MASK \
@ -124,6 +125,7 @@ typedef struct {
int type;
void *arg;
} file_selection_t;
#endif
/******************************************************************************
* init
@ -131,7 +133,7 @@ typedef struct {
void
WinUI_Init(void)
{
#if 0
/*
*
*/
@ -160,8 +162,10 @@ WinUI_Init(void)
*
*/
hTimerID = gtk_timeout_add(500, wm_timer, (gpointer)window);
#endif
}
#if 0
/******************************************************************************
*
******************************************************************************/
@ -473,8 +477,9 @@ static void select_item(char *name);
static void xmenu_select_framerate(int kind);
static void xmenu_select_stretch(int kind);
//static void xmenu_select_xvimode(int kind);
#endif
#if 0
GtkWidget *
create_menu(GtkWidget *w)
{
@ -510,7 +515,9 @@ create_menu(GtkWidget *w)
return gtk_item_factory_get_widget(item_factory, "<main>");
}
#endif
#if 0
static void
disable_unused_items(void)
{
@ -1015,3 +1022,4 @@ file_selection(int type, char *title, char *defstr, void *arg)
gtk_widget_show(file_dialog);
}
#endif

View File

@ -11,10 +11,12 @@ void WinUI_Init(void);
#ifndef _winx68k_gtkui_h
#define _winx68k_gtkui_h
#if 0
#include <gdk/gdk.h>
#include <gtk/gtk.h>
GtkWidget *create_menu(GtkWidget *w);
#endif
#endif //winx68k_gtkui_h

View File

@ -93,16 +93,22 @@ static int ClkUsed = 0;
static int FrameSkipCount = 0;
static int FrameSkipQueue = 0;
#if 0
GtkWidget *window;
GtkWidget *main_vbox;
GtkWidget *menubar;
GtkWidget *drawarea;
#endif
#if 0
static void set_window_size(GtkWidget *);
static void set_icon_bitmap(GtkWidget *);
#endif
#if 0
typedef void sigfunc(int);
static sigfunc *setup_signal(int, sigfunc *);
static void sighandler(int);
#endif
#ifdef __cplusplus
};
@ -131,14 +137,25 @@ WinX68k_SCSICheck(void)
};
DWORD *p;
WORD *p1, *p2;
int scsi;
int i;
scsi = 0;
for (i = 0x30600; i < 0x30c00; i += 2) {
#if 0 // 4の倍数ではない偶数アドレスからの4バイト長アクセスはMIPSには無理
p = (DWORD *)(&IPL[i]);
if (*p == 0x0000fc00)
scsi = 1;
#else
p1 = (WORD *)(&IPL[i]);
p2 = p1 + 1;
// xxx: works only for little endian guys
if (*p1 == 0xfc00 && *p2 == 0x0000) {
scsi = 1;
break;
}
#endif
}
// SCSIモデルのとき
@ -498,6 +515,7 @@ void WinX68k_Exec(void)
}
}
#if 0
/*
* signal handler
*/
@ -522,7 +540,9 @@ sighandler(int signo)
gtk_main_quit();
}
#endif
#if 0
/*
* misc
*/
@ -544,7 +564,9 @@ set_icon_bitmap(GtkWidget *w)
w->window, keropi_mono_bits, keropi_mono_width, keropi_mono_height);
gdk_window_set_icon(w->window, NULL, icon_pixmap, NULL);
}
#endif
#if 0
//
// IDLE process
//
@ -589,14 +611,24 @@ uninstall_idle_process(void)
gtk_idle_remove(idle_id);
idle_id = -1;
}
#endif
//
// main
//
int
#ifdef PSP
#include <pspmoduleinfo.h>
PSP_HEAP_SIZE_KB(-1024);
extern "C" int
SDL_main(int argc, char *argv[])
#else
main(int argc, char *argv[])
#endif
{
SDL_Event ev;
int sdlaudio = -1;
if (set_modulepath(winx68k_dir, sizeof(winx68k_dir)))
@ -619,10 +651,16 @@ main(int argc, char *argv[])
}
#endif
SDL_WM_SetCaption(APPNAME" SDL", NULL);
#ifndef PSP
if (SDL_SetVideoMode(FULLSCREEN_WIDTH, FULLSCREEN_HEIGHT, 16, SDL_SWSURFACE) == NULL) {
#else
if (SDL_SetVideoMode(480, 272, 16, SDL_SWSURFACE) == NULL) {
#endif
puts("SDL_SetVideoMode() failed");
return 1;
}
#if 0
gtk_set_locale();
gtk_rc_add_default_file(".xkeropirc");
gtk_init(&argc, &argv);
@ -634,9 +672,13 @@ main(int argc, char *argv[])
gtk_container_border_width(GTK_CONTAINER(main_vbox), 1);
gtk_container_add(GTK_CONTAINER(window), main_vbox);
gtk_widget_show(main_vbox);
#endif
#if 0
/* メニューバー */
menubar = create_menu(window);
#endif
#if 0
gtk_box_pack_start(GTK_BOX(main_vbox), menubar, FALSE, TRUE, 0);
gtk_widget_show(menubar);
@ -654,7 +696,7 @@ main(int argc, char *argv[])
gtk_window_set_title(GTK_WINDOW(window), APPNAME);
set_window_size(window);
set_icon_bitmap(window);
#endif
SplashFlag = 20;
SoundSampleRate = Config.SampleRate;
@ -671,8 +713,10 @@ main(int argc, char *argv[])
return 1;
}
#if 0
/* window 表示 */
gtk_widget_show(window);
#endif
if (!WinX68k_Init()) {
WinX68k_Cleanup();
@ -722,6 +766,10 @@ main(int argc, char *argv[])
#endif
DSound_Play();
#ifdef PSP
FDD_SetFD(0, "FDD1.XDF", 0);
FDD_SetFD(1, "FDD2.XDF", 0);
#else
//SetCmdLineFD(); // コマンドラインでFD挿入を指示している場合
switch (argc) {
case 3:
@ -730,7 +778,9 @@ main(int argc, char *argv[])
FDD_SetFD(0, argv[1], 0);
break;
}
#endif
#if 0
setup_signal(SIGINT, sighandler);
setup_signal(SIGTERM, sighandler);
@ -738,6 +788,30 @@ main(int argc, char *argv[])
install_idle_process();
gtk_main();
uninstall_idle_process();
#endif
puts("hoge");
while (1) {
// OPM_RomeoOut(Config.BufferSize * 5);
if (NoWaitMode || Timer_GetCount()) {
WinX68k_Exec();
if (SplashFlag) {
SplashFlag--;
if (SplashFlag == 0)
WinDraw_HideSplash();
}
}
while (SDL_PollEvent(&ev)) {
switch (ev.type) {
case SDL_QUIT:
goto end_loop;
case SDL_KEYDOWN:
break;
}
}
}
end_loop:
Memory_WriteB(0xe8e00d, 0x31); // SRAM書き込み許可
Memory_WriteD(0xed0040, Memory_ReadD(0xed0040)+1); // 積算稼働時間(min.)

View File

@ -1,6 +1,8 @@
#ifndef winx68k_wincore_h
#define winx68k_wincore_h
#include "common.h"
#define SCREEN_WIDTH 768
#define SCREEN_HEIGHT 512
@ -30,6 +32,7 @@ int WinX68k_Reset(void);
#include <unistd.h>
#include <signal.h>
#if 0
#include <gdk/gdk.h>
#include <gtk/gtk.h>
@ -38,6 +41,7 @@ extern GtkWidget *main_vbox;
extern GtkWidget *menubar;
extern GtkWidget *drawarea;
extern GdkPixmap *splash_pixmap;
#endif
BOOL is_installed_idle_process(void);
void install_idle_process(void);

View File

@ -574,7 +574,8 @@ AdrError(DWORD adr, DWORD unknown)
(void)adr;
(void)unknown;
assert(0);
printf("AdrError: %d\n", adr);
// assert(0);
}
void
@ -584,6 +585,7 @@ BusError(DWORD adr, DWORD unknown)
(void)adr;
(void)unknown;
printf("BusError: %d\n", adr);
BusErrHandling = 1;
//assert(0);
}