From b34c48962a7429cfb83909241eddced6e3fc581c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 20 Sep 2019 22:55:44 +0200 Subject: [PATCH] - removed some unused files. --- platform/Windows/build.vcxproj | 12 - platform/Windows/build.vcxproj.filters | 2 - source/build/src/sdlayer12.cpp | 557 ------------------------ source/build/src/startgtk.editor.cpp | 548 ------------------------ source/build/src/startwin.editor.cpp | 493 ---------------------- source/build/src/wiibits.cpp | 560 ------------------------- 6 files changed, 2172 deletions(-) delete mode 100644 source/build/src/sdlayer12.cpp delete mode 100644 source/build/src/startgtk.editor.cpp delete mode 100644 source/build/src/startwin.editor.cpp delete mode 100644 source/build/src/wiibits.cpp diff --git a/platform/Windows/build.vcxproj b/platform/Windows/build.vcxproj index 76b1863a4..2a59774bf 100644 --- a/platform/Windows/build.vcxproj +++ b/platform/Windows/build.vcxproj @@ -269,12 +269,6 @@ - - true - true - true - true - true true @@ -288,12 +282,6 @@ - - true - true - true - true - diff --git a/platform/Windows/build.vcxproj.filters b/platform/Windows/build.vcxproj.filters index 4d9e61703..f35a9aeb6 100644 --- a/platform/Windows/build.vcxproj.filters +++ b/platform/Windows/build.vcxproj.filters @@ -43,7 +43,6 @@ - @@ -52,7 +51,6 @@ - diff --git a/source/build/src/sdlayer12.cpp b/source/build/src/sdlayer12.cpp deleted file mode 100644 index bedc4d0ab..000000000 --- a/source/build/src/sdlayer12.cpp +++ /dev/null @@ -1,557 +0,0 @@ -// SDL 1.2 compatibility. - -#include - -#ifdef _WIN32 -HWND win_gethwnd(void) -{ - struct SDL_SysWMinfo wmInfo; - SDL_VERSION(&wmInfo.version); - - if (SDL_GetWMInfo(&wmInfo) != 1) - { - initprintf("win_gethwnd: SDL_GetWindowWMInfo() failed: %s\n", SDL_GetError()); - return 0; - } - - return wmInfo.window; -} -#endif - -int32_t videoSetVsync(int32_t newSync) -{ - if (vsync_renderlayer == newSync) - return newSync; - - vsync_renderlayer = newSync; - - videoResetMode(); - if (videoSetGameMode(fullscreen, xres, yres, bpp, upscalefactor)) - OSD_Printf("restartvid: Reset failed...\n"); - - return newSync; -} - -int32_t sdlayer_checkversion(void) -{ - const SDL_version *linked = SDL_Linked_Version(); - SDL_version compiled; - - SDL_VERSION(&compiled); - - initprintf("Initializing SDL system interface " - "(compiled against SDL version %d.%d.%d, found version %d.%d.%d)\n", - compiled.major, compiled.minor, compiled.patch, linked->major, linked->minor, linked->patch); - - if (SDL_VERSIONNUM(linked->major, linked->minor, linked->patch) < SDL_REQUIREDVERSION) - { - /*reject running under SDL versions older than what is stated in sdl_inc.h */ - initprintf("You need at least v%d.%d.%d of SDL to run this game\n", SDL_MIN_X, SDL_MIN_Y, SDL_MIN_Z); - return -1; - } - - return 0; -} - -// -// initsystem() -- init SDL systems -// -int32_t initsystem(void) -{ -#if defined NOSDLPARACHUTE - const int sdlinitflags = SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE; -#else - const int sdlinitflags = SDL_INIT_VIDEO; -#endif - - mutex_init(&m_initprintf); - -#ifdef _WIN32 - win_init(); -#endif - - if (sdlayer_checkversion()) - return -1; - - if (SDL_Init(sdlinitflags)) - { - initprintf("Initialization failed! (%s)\nNon-interactive mode enabled\n", SDL_GetError()); - novideo = 1; -#ifdef USE_OPENGL - nogl = 1; -#endif - } - - atexit(uninitsystem); - - frameplace = 0; - lockcount = 0; - - - if (!novideo) - { - char drvname[32]; - -#ifdef USE_OPENGL - if (SDL_GL_LoadLibrary(0)) - { - initprintf("Failed loading OpenGL driver. GL modes will be unavailable.\n"); - nogl = 1; - } -#ifdef POLYMER - if (loadglulibrary(getenv("BUILD_GLULIB"))) - { - initprintf("Failed loading GLU. GL modes will be unavailable.\n"); - nogl = 1; - } -#endif -#endif - - if (SDL_VideoDriverName(drvname, 32)) - initprintf("Using \"%s\" video driver\n", drvname); - - wm_setapptitle(apptitle); - } - -#if defined GEKKO - SDL_ShowCursor(SDL_DISABLE); -#endif - - return 0; -} - -#ifdef GEKKO -static const char *joynames[3][15] = { - { - "Left Stick X", "Left Stick Y", "Right Stick X", "Right Stick Y", "Axis 5", "Axis 6", "Axis 7", "Axis 8", - "Axis 9", "Axis 10", "Axis 11", "Axis 12", "Axis 13", "Axis 14", "Axis 15", - }, - { - "Button A", "Button B", "Button 1", "Button 2", "Button -", "Button +", "Button HOME", "Button Z", "Button C", - "Button X", "Button Y", "Trigger L", "Trigger R", "Trigger ZL", "Trigger ZR", - }, - { - "D-Pad Up", "D-Pad Right", "D-Pad Down", "D-Pad Left", "Hat 5", "Hat 6", "Hat 7", "Hat 8", "Hat 9", "Hat 10", - "Hat 11", "Hat 12", "Hat 13", "Hat 14", "Hat 15", - } -}; -const char *joyGetName(int32_t what, int32_t num) -{ - switch (what) - { - case 0: // axis - if ((unsigned)num > (unsigned)joystick.numAxes) return NULL; - return joynames[0][num]; - - case 1: // button - if ((unsigned)num > (unsigned)joystick.numButtons) return NULL; - return joynames[1][num]; - - case 2: // hat - if ((unsigned)num > (unsigned)joystick.numHats) return NULL; - return joynames[2][num]; - - default: - return NULL; - } -} -#endif - -// -// grabmouse_low() -- show/hide mouse cursor, lower level (doesn't check state). -// furthermore return 0 if successful. -// - -static inline char grabmouse_low(char a) -{ -#if !defined GEKKO - SDL_ShowCursor(a ? SDL_DISABLE : SDL_ENABLE); - return (SDL_WM_GrabInput(a ? SDL_GRAB_ON : SDL_GRAB_OFF) != (a ? SDL_GRAB_ON : SDL_GRAB_OFF)); -#else - UNREFERENCED_PARAMETER(a); - return 0; -#endif -} - -void videoGetModes(void) -{ - int32_t i, maxx = 0, maxy = 0; - int32_t j; - static int32_t cdepths[] = { 8, -#ifdef USE_OPENGL - 16, 24, 32, -#endif - 0 }; - SDL_Rect **modes; - SDL_PixelFormat pf; - - pf.palette = NULL; - pf.BitsPerPixel = 8; - pf.BytesPerPixel = 1; - - if (modeschecked || novideo) - return; - - validmodecnt = 0; - // initprintf("Detecting video modes:\n"); - - // do fullscreen modes first - for (j = 0; cdepths[j]; j++) - { -#ifdef USE_OPENGL - if (nogl && cdepths[j] > 8) - continue; -#endif - pf.BitsPerPixel = cdepths[j]; - pf.BytesPerPixel = cdepths[j] >> 3; - - // We convert paletted contents to non-paletted - modes = SDL_ListModes((cdepths[j] == 8) ? NULL : &pf, SURFACE_FLAGS | SDL_FULLSCREEN); - - if (modes == (SDL_Rect **)0) - { - if (cdepths[j] > 8) - cdepths[j] = -1; - continue; - } - - if (modes == (SDL_Rect **)-1) - { - for (i = 0; g_defaultVideoModes[i].x; i++) - SDL_ADDMODE(g_defaultVideoModes[i].x, g_defaultVideoModes[i].y, cdepths[j], 1); - } - else - { - for (i = 0; modes[i]; i++) - { - if (!SDL_CHECKMODE(modes[i]->w, modes[i]->h)) - continue; - - SDL_ADDMODE(modes[i]->w, modes[i]->h, cdepths[j], 1); - - if ((modes[i]->w > maxx) || (modes[i]->h > maxy)) - { - maxx = modes[i]->w; - maxy = modes[i]->h; - } - } - } - } - - SDL_CHECKFSMODES(maxx, maxy); - - // add windowed modes next - for (j = 0; cdepths[j]; j++) - { -#ifdef USE_OPENGL - if (nogl && cdepths[j] > 8) - continue; -#endif - if (cdepths[j] < 0) - continue; - - for (i = 0; g_defaultVideoModes[i].x; i++) - { - auto &mode = g_defaultVideoModes[i]; - if (mode.x > maxx || mode.y > maxy || !SDL_CHECKMODE(mode.x, mode.y)) - continue; - - SDL_ADDMODE(mode.x, mode.y, cdepths[j], 0); - } - } - - qsort((void *)validmode, validmodecnt, sizeof(struct validmode_t), &sortmodes); - - modeschecked = 1; -} - -// -// setvideomode() -- set SDL video mode -// -int32_t videoSetMode(int32_t x, int32_t y, int32_t c, int32_t fs) -{ - int32_t regrab = 0, ret; -#ifdef USE_OPENGL - static int32_t ovsync = 1; -#endif - - ret = setvideomode_sdlcommon(&x, &y, c, fs, ®rab); - if (ret != 1) - { - if (ret == 0) - { - setvideomode_sdlcommonpost(x, y, c, fs, regrab); - } - return ret; - } - - // restore gamma before we change video modes if it was changed - if (sdl_surface && gammabrightness) - { - SDL_SetGammaRamp(sysgamma[0], sysgamma[1], sysgamma[2]); - gammabrightness = 0; // redetect on next mode switch - } - - // deinit - destroy_window_resources(); - - initprintf("Setting video mode %dx%d (%d-bpp %s)\n", x, y, c, ((fs & 1) ? "fullscreen" : "windowed")); - -#ifdef USE_OPENGL - if (c > 8 || !nogl) - { - int32_t i, j, multisamplecheck = (glmultisample > 0); - - if (nogl) - return -1; - -# ifdef _WIN32 - win_setvideomode(c); -# endif - - struct glattribs - { - SDL_GLattr attr; - int32_t value; - } sdlayer_gl_attributes [] = - { - { SDL_GL_DOUBLEBUFFER, 1 }, - { SDL_GL_MULTISAMPLEBUFFERS, glmultisample > 0 }, - { SDL_GL_MULTISAMPLESAMPLES, glmultisample }, - { SDL_GL_STENCIL_SIZE, 8 }, - { SDL_GL_ACCELERATED_VISUAL, 1 }, - { SDL_GL_SWAP_CONTROL, vsync_renderlayer }, - }; - - do - { - SDL_GL_ATTRIBUTES(i, sdlayer_gl_attributes); - - /* HACK: changing SDL GL attribs only works before surface creation, - so we have to create a new surface in a different format first - to force the surface we WANT to be recreated instead of reused. */ - if (vsync_renderlayer != ovsync) - { - if (sdl_surface) - { - SDL_FreeSurface(sdl_surface); - sdl_surface = - SDL_SetVideoMode(1, 1, 8, SDL_NOFRAME | SURFACE_FLAGS | ((fs & 1) ? SDL_FULLSCREEN : 0)); - SDL_FreeSurface(sdl_surface); - } - ovsync = vsync_renderlayer; - } - sdl_surface = SDL_SetVideoMode(x, y, c, SDL_OPENGL | ((fs & 1) ? SDL_FULLSCREEN : 0)); - if (!sdl_surface) - { - if (multisamplecheck) - { - initprintf("Multisample mode not possible. Retrying without multisampling.\n"); - glmultisample = 0; - continue; - } - initprintf("Unable to set video mode!\n"); - return -1; - } - } while (multisamplecheck--); - - gladLoadGLLoader(SDL_GL_GetProcAddress); - } - else -#endif // defined USE_OPENGL - { - // We convert paletted contents to non-paletted - sdl_surface = SDL_SetVideoMode(x, y, 0, SURFACE_FLAGS | ((fs & 1) ? SDL_FULLSCREEN : 0)); - - if (!sdl_surface) - { - initprintf("Unable to set video mode!\n"); - return -1; - } - } - - setvideomode_sdlcommonpost(x, y, c, fs, regrab); - - return 0; -} - -// -// showframe() -- update the display -// -void videoShowFrame(int32_t w) -{ - UNREFERENCED_PARAMETER(w); - -#ifdef USE_OPENGL - if (!nogl) - { - if (bpp > 8) - { - if (palfadedelta) - fullscreen_tint_gl(palfadergb.r, palfadergb.g, palfadergb.b, palfadedelta); - } - else - { - glsurface_blitBuffer(); - } - - SDL_GL_SwapBuffers(); - return; - } -#endif - - if (offscreenrendering) return; - - if (lockcount) - { - printf("Frame still locked %d times when showframe() called.\n", lockcount); - while (lockcount) videoEndDrawing(); - } - - if (SDL_MUSTLOCK(sdl_surface)) SDL_LockSurface(sdl_surface); - softsurface_blitBuffer((uint32_t*) sdl_surface->pixels, sdl_surface->format->BitsPerPixel); - if (SDL_MUSTLOCK(sdl_surface)) SDL_UnlockSurface(sdl_surface); - - SDL_Flip(sdl_surface); -} - - -// SDL 1.2 specific event handling -int32_t handleevents_pollsdl(void) -{ - int32_t code, rv = 0, j; - SDL_Event ev; - - while (SDL_PollEvent(&ev)) - { - switch (ev.type) - { - case SDL_KEYDOWN: - case SDL_KEYUP: - code = keytranslation[ev.key.keysym.sym]; -#ifdef KEY_PRINT_DEBUG - printf("keytranslation[%d] = %s (%d) %s\n", ev.key.keysym.sym, g_keyNameTable[code], code, - ev.key.type == SDL_KEYDOWN ? "DOWN" : "UP"); -#endif - if (code != OSD_OSDKey() && ev.key.keysym.unicode != 0 && ev.key.type == SDL_KEYDOWN && - (ev.key.keysym.unicode & 0xff80) == 0 && !keyBufferFull()) - { - if (OSD_HandleChar(ev.key.keysym.unicode & 0x7f)) - keyBufferInsert(ev.key.keysym.unicode & 0x7f); - } - - // hook in the osd - if ((j = OSD_HandleScanCode(code, (ev.key.type == SDL_KEYDOWN))) <= 0) - { - if (j == -1) // osdkey - { - for (j = 0; j < NUMKEYS; ++j) - { - if (keyGetState(j)) - { - keySetState(j, 0); - if (keypresscallback) - keypresscallback(j, 0); - } - } - } - break; - } - - if (ev.key.type == SDL_KEYDOWN) - { - if (!keyGetState(code)) - { - keySetState(code, 1); - if (keypresscallback) - keypresscallback(code, 1); - } - } - else - { -#ifdef __linux - if (code == 0x59) // pause - break; -#endif - keySetState(code, 0); - if (keypresscallback) - keypresscallback(code, 0); - } - break; - - case SDL_ACTIVEEVENT: - if (ev.active.state & SDL_APPINPUTFOCUS) - { - appactive = ev.active.gain; - if (g_mouseGrabbed && g_mouseEnabled) - grabmouse_low(!!appactive); -# ifdef _WIN32 - // Win_SetKeyboardLayoutUS(appactive); - - if (backgroundidle) - SetPriorityClass(GetCurrentProcess(), - appactive ? NORMAL_PRIORITY_CLASS : IDLE_PRIORITY_CLASS); -# endif - rv = -1; - - if (ev.active.state & SDL_APPMOUSEFOCUS) - g_mouseInsideWindow = ev.active.gain; - } - break; - - // SDL_MOUSEMOTION needs to fall through to default... this is just GEKKO processing! - case SDL_MOUSEMOTION: -#ifdef GEKKO - // check if it's a wiimote pointer pretending to be a mouse - if (ev.motion.state & SDL_BUTTON_X2MASK) - { - // the absolute values are used to draw the crosshair - g_mouseAbs.x = ev.motion.x; - g_mouseAbs.y = ev.motion.y; - // hack: reduce the scale of the "relative" motions - // to make it act more like a real mouse - ev.motion.xrel /= 16; - ev.motion.yrel /= 12; - } -#endif - fallthrough__; - default: // OSD_Printf("Got event (%d)\n", ev.type); break; - rv = handleevents_sdlcommon(&ev); - break; - } - } - - return rv; -} - -// from SDL HG, modified -int32_t SDL_WaitEventTimeout(SDL_Event *event, int32_t timeout) -{ - uint32_t expiration = 0; - - if (timeout > 0) - expiration = SDL_GetTicks() + timeout; - - for (;;) - { - SDL_PumpEvents(); - switch (SDL_PeepEvents(event, 1, SDL_GETEVENT, ~0)) // SDL_FIRSTEVENT, SDL_LASTEVENT)) { - { - case -1: return 0; - case 1: return 1; - case 0: - if (timeout == 0) - { - /* Polling and no events, just return */ - return 0; - } - if (timeout > 0 && ((int32_t)(SDL_GetTicks() - expiration) >= 0)) - { - /* Timeout expired and no events */ - return 0; - } - SDL_Delay(10); - break; - } - } -} diff --git a/source/build/src/startgtk.editor.cpp b/source/build/src/startgtk.editor.cpp deleted file mode 100644 index 1df9dffd7..000000000 --- a/source/build/src/startgtk.editor.cpp +++ /dev/null @@ -1,548 +0,0 @@ - -#include "gtkpixdata.h" - -#include "dynamicgtk.h" - -#include "build.h" -#include "editor.h" -#include "baselayer.h" - -enum -{ - TAB_CONFIG, - TAB_MESSAGES, -}; - -static struct -{ - GtkWidget *startwin; - GtkWidget *hlayout; - GtkWidget *banner; - GtkWidget *vlayout; - GtkWidget *tabs; - GtkWidget *configtlayout; - GtkWidget *vmode2dlabel; - GtkWidget *vmode3dlabel; - GtkWidget *vmode2dcombo; - GtkWidget *vmode3dcombo; - GtkWidget *fullscreencheck; - GtkWidget *emptyhlayout; - GtkWidget *alwaysshowcheck; - GtkWidget *configtab; - GtkWidget *messagesscroll; - GtkWidget *messagestext; - GtkWidget *messagestab; - GtkWidget *buttons; - GtkWidget *cancelbutton; - GtkWidget *cancelbuttonalign; - GtkWidget *cancelbuttonlayout; - GtkWidget *cancelbuttonicon; - GtkWidget *cancelbuttonlabel; - GtkWidget *startbutton; - GtkWidget *startbuttonalign; - GtkWidget *startbuttonlayout; - GtkWidget *startbuttonicon; - GtkWidget *startbuttonlabel; - GtkAccelGroup *accel_group; -} stwidgets; - -static struct -{ - int32_t fullscreen; - int32_t xdim2d, ydim2d; - int32_t xdim3d, ydim3d, bpp3d; - int32_t forcesetup; -} settings; - -static int32_t retval = -1, mode = TAB_MESSAGES; -extern int32_t gtkenabled; -static void PopulateForm(void); - -// -- EVENT CALLBACKS AND CREATION STUFF -------------------------------------- - -static void on_vmode2dcombo_changed(GtkComboBox *combobox, gpointer user_data) -{ - GtkTreeModel *data; - GtkTreeIter iter; - int32_t val; - UNREFERENCED_PARAMETER(user_data); - if (!gtk_combo_box_get_active_iter(combobox, &iter)) return; - if (!(data = gtk_combo_box_get_model(combobox))) return; - gtk_tree_model_get(data, &iter, 1, &val, -1); - settings.xdim2d = validmode[val].xdim; - settings.ydim2d = validmode[val].ydim; -} - -static void on_vmode3dcombo_changed(GtkComboBox *combobox, gpointer user_data) -{ - GtkTreeModel *data; - GtkTreeIter iter; - int32_t val; - UNREFERENCED_PARAMETER(user_data); - if (!gtk_combo_box_get_active_iter(combobox, &iter)) return; - if (!(data = gtk_combo_box_get_model(combobox))) return; - gtk_tree_model_get(data, &iter, 1, &val, -1); - settings.xdim3d = validmode[val].xdim; - settings.ydim3d = validmode[val].ydim; - settings.bpp3d = validmode[val].bpp; -} - -static void on_fullscreencheck_toggled(GtkToggleButton *togglebutton, gpointer user_data) -{ - UNREFERENCED_PARAMETER(user_data); - settings.fullscreen = (gtk_toggle_button_get_active(togglebutton) == TRUE); - PopulateForm(); -} - -static void on_alwaysshowcheck_toggled(GtkToggleButton *togglebutton, gpointer user_data) -{ - UNREFERENCED_PARAMETER(user_data); - settings.forcesetup = (gtk_toggle_button_get_active(togglebutton) == TRUE); -} - -static void on_cancelbutton_clicked(GtkButton *button, gpointer user_data) -{ - UNREFERENCED_PARAMETER(button); - UNREFERENCED_PARAMETER(user_data); - if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); } - else quitevent++; -} - -static void on_startbutton_clicked(GtkButton *button, gpointer user_data) -{ - UNREFERENCED_PARAMETER(button); - UNREFERENCED_PARAMETER(user_data); - retval = 1; - gtk_main_quit(); -} - -static gboolean on_startwin_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) -{ - UNREFERENCED_PARAMETER(widget); - UNREFERENCED_PARAMETER(event); - UNREFERENCED_PARAMETER(user_data); - if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); } - else quitevent++; - return TRUE; // FALSE would let the event go through. we want the game to decide when to close -} - -// -- SUPPORT FUNCTIONS ------------------------------------------------------- - -static GdkPixbuf *load_banner(void) -{ - return gdk_pixbuf_from_pixdata((GdkPixdata const *)&startbanner_pixdata, FALSE, NULL); -} - -static void SetPage(int32_t n) -{ - if (!gtkenabled || !stwidgets.startwin) return; - mode = n; - gtk_notebook_set_current_page(GTK_NOTEBOOK(stwidgets.tabs), n); - - // each control in the config page vertical layout plus the start button should be made (in)sensitive - if (n == TAB_CONFIG) n = TRUE; else n = FALSE; - gtk_widget_set_sensitive(stwidgets.startbutton, n); - gtk_container_foreach(GTK_CONTAINER(stwidgets.configtlayout), - (GtkCallback)gtk_widget_set_sensitive, - (gpointer)&n); -} - -static void PopulateForm(void) -{ - int32_t mode2d, mode3d, i; - GtkListStore *modes2d, *modes3d; - GtkTreeIter iter; - GtkComboBox *box2d, *box3d; - char buf[64]; - - mode2d = videoCheckMode(&settings.xdim2d, &settings.ydim2d, 8, settings.fullscreen, 1); - mode3d = videoCheckMode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1); - if (mode2d < 0) mode2d = 0; - if (mode3d < 0) - { - int32_t i, cd[] = { 32, 24, 16, 15, 8, 0 }; - for (i=0; cd[i];) { if (cd[i] >= settings.bpp3d) i++; else break; } - for (; cd[i]; i++) - { - mode3d = videoCheckMode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1); - if (mode3d < 0) continue; - settings.bpp3d = cd[i]; - break; - } - } - - box2d = GTK_COMBO_BOX(stwidgets.vmode2dcombo); - box3d = GTK_COMBO_BOX(stwidgets.vmode3dcombo); - modes2d = GTK_LIST_STORE(gtk_combo_box_get_model(box2d)); - modes3d = GTK_LIST_STORE(gtk_combo_box_get_model(box3d)); - gtk_list_store_clear(modes2d); - gtk_list_store_clear(modes3d); - - for (i=0; i aptr) - gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)-1); -#if GTK_CHECK_VERSION(2,6,0) - gtk_text_buffer_backspace(textbuffer, &enditer, FALSE, TRUE); -#else - { - GtkTextIter iter2 = enditer; - gtk_text_iter_backward_cursor_position(&iter2); - //FIXME: this seems be deleting one too many chars somewhere! - if (!gtk_text_iter_equal(&iter2, &enditer)) - gtk_text_buffer_delete_interactive(textbuffer, &iter2, &enditer, TRUE); - } -#endif - aptr = ++bptr; - break; - case 0: - if (bptr > aptr) - gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)); - aptr = bptr; - break; - case '\r': // FIXME - default: - bptr++; - break; - } - } - - mark = gtk_text_buffer_create_mark(textbuffer, NULL, &enditer, 1); - gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(textview), mark, 0.0, FALSE, 0.0, 1.0); - gtk_text_buffer_delete_mark(textbuffer, mark); - - return 0; -} - -int32_t startwin_settitle(const char *title) -{ - if (!gtkenabled) return 0; - if (!stwidgets.startwin) return 1; - gtk_window_set_title(GTK_WINDOW(stwidgets.startwin), title); - return 0; -} - -int32_t startwin_idle(void *s) -{ - UNREFERENCED_PARAMETER(s); - if (!gtkenabled) return 0; - //if (!stwidgets.startwin) return 1; - gtk_main_iteration_do(FALSE); - return 0; -} - -int32_t startwin_run(void) -{ - if (!gtkenabled) return 1; - if (!stwidgets.startwin) return 1; - - SetPage(TAB_CONFIG); - - settings.fullscreen = fullscreen; - settings.xdim2d = xdim2d; - settings.ydim2d = ydim2d; - settings.xdim3d = xdimgame; - settings.ydim3d = ydimgame; - settings.bpp3d = bppgame; - settings.forcesetup = forcesetup; - PopulateForm(); - - gtk_main(); - - SetPage(TAB_MESSAGES); - if (retval) - { - fullscreen = settings.fullscreen; - xdim2d = settings.xdim2d; - ydim2d = settings.ydim2d; - xdimgame = settings.xdim3d; - ydimgame = settings.ydim3d; - bppgame = settings.bpp3d; - forcesetup = settings.forcesetup; - } - - return retval; -} diff --git a/source/build/src/startwin.editor.cpp b/source/build/src/startwin.editor.cpp deleted file mode 100644 index f8780f94f..000000000 --- a/source/build/src/startwin.editor.cpp +++ /dev/null @@ -1,493 +0,0 @@ -#ifndef _WIN32 -#error Only for Windows -#endif - -#include "compat.h" - -#define NEED_WINDOWSX_H -#define NEED_COMMCTRL_H -#include "windows_inc.h" - -#include "renderlayer.h" - -#ifdef STARTUP_SETUP_WINDOW - -#include "build.h" -#include "editor.h" -#include "winlayer.h" - -#include "startwin.editor.h" - -#define TAB_CONFIG 0 -#define TAB_MESSAGES 1 - -static struct -{ - int32_t fullscreen; - int32_t xdim2d, ydim2d; - int32_t xdim3d, ydim3d, bpp3d; - int32_t forcesetup; -} settings; - -static HWND startupdlg = NULL; -static HWND pages[2] = { NULL, NULL}; -static int32_t done = -1, mode = TAB_CONFIG; - -static void PopulateForm(void) -{ - int32_t i,j; - char buf[64]; - int32_t mode2d, mode3d; - HWND hwnd2d, hwnd3d; - - hwnd2d = GetDlgItem(pages[TAB_CONFIG], IDC2DVMODE); - hwnd3d = GetDlgItem(pages[TAB_CONFIG], IDC3DVMODE); - - mode2d = videoCheckMode(&settings.xdim2d, &settings.ydim2d, 8, settings.fullscreen, 1); - mode3d = videoCheckMode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1); - if (mode2d < 0) mode2d = 0; - if (mode3d < 0) - { - int32_t cd[] = { 32, 24, 16, 15, 8, 0 }; - for (i=0; cd[i];) { if (cd[i] >= settings.bpp3d) i++; else break; } - for (; cd[i]; i++) - { - mode3d = videoCheckMode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1); - if (mode3d < 0) continue; - settings.bpp3d = cd[i]; - break; - } - } - - Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), (settings.fullscreen ? BST_CHECKED : BST_UNCHECKED)); - Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCALWAYSSHOW), (settings.forcesetup ? BST_CHECKED : BST_UNCHECKED)); - - (void)ComboBox_ResetContent(hwnd2d); - (void)ComboBox_ResetContent(hwnd3d); - for (i=0; iidFrom != WIN_STARTWIN_TABCTL) break; - cur = (int32_t)SendMessage(nmhdr->hwndFrom, TCM_GETCURSEL,0,0); - switch (nmhdr->code) - { - case TCN_SELCHANGING: - { - if (cur < 0 || !pages[cur]) break; - ShowWindow(pages[cur],SW_HIDE); - return TRUE; - } - case TCN_SELCHANGE: - { - if (cur < 0 || !pages[cur]) break; - ShowWindow(pages[cur],SW_SHOW); - return TRUE; - } - } - break; - } - - case WM_CLOSE: - if (mode == TAB_CONFIG) done = 0; - else quitevent++; - return TRUE; - - case WM_DESTROY: - if (hbmp) - { - DeleteObject(hbmp); - hbmp = NULL; - } - - if (pages[TAB_CONFIG]) - { - DestroyWindow(pages[TAB_CONFIG]); - pages[TAB_CONFIG] = NULL; - } - - startupdlg = NULL; - return TRUE; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case WIN_STARTWIN_CANCEL: - if (mode == TAB_CONFIG) done = 0; - else quitevent++; - return TRUE; - case WIN_STARTWIN_START: - done = 1; return TRUE; - } - return FALSE; - - case WM_CTLCOLORSTATIC: - if ((HWND)lParam == pages[TAB_MESSAGES]) - return (BOOL)(intptr_t)GetSysColorBrush(COLOR_WINDOW); - break; - - default: - break; - } - - return FALSE; -} - - -int32_t startwin_open(void) -{ - INITCOMMONCONTROLSEX icc; - if (startupdlg) return 1; - icc.dwSize = sizeof(icc); - icc.dwICC = ICC_TAB_CLASSES; - InitCommonControlsEx(&icc); - startupdlg = CreateDialog((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(WIN_STARTWIN), NULL, startup_dlgproc); - if (startupdlg) - { - SetPage(TAB_MESSAGES); - EnableConfig(0); - return 0; - } - return -1; -} - -int32_t startwin_close(void) -{ - if (!startupdlg) return 1; - DestroyWindow(startupdlg); - startupdlg = NULL; - return 0; -} - -int32_t startwin_puts(const char *buf) -{ - const char *p = NULL, *q = NULL; - static char workbuf[1024]; - static int32_t newline = 0; - int32_t curlen, linesbefore, linesafter; - HWND edctl; - int32_t vis; - static HWND dactrl = NULL; - - if (!startupdlg) return 1; - - edctl = pages[TAB_MESSAGES]; - if (!edctl) return -1; - - if (!dactrl) dactrl = GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL); - - vis = ((int32_t)SendMessage(dactrl, TCM_GETCURSEL,0,0) == TAB_MESSAGES); - - if (vis) SendMessage(edctl, WM_SETREDRAW, FALSE,0); - curlen = SendMessage(edctl, WM_GETTEXTLENGTH, 0,0); - SendMessage(edctl, EM_SETSEL, (WPARAM)curlen, (LPARAM)curlen); - linesbefore = SendMessage(edctl, EM_GETLINECOUNT, 0,0); - p = buf; - while (*p) - { - if (newline) - { - SendMessage(edctl, EM_REPLACESEL, 0, (LPARAM)"\r\n"); - newline = 0; - } - q = p; - while (*q && *q != '\n') q++; - Bmemcpy(workbuf, p, q-p); - if (*q == '\n') - { - if (!q[1]) - { - newline = 1; - workbuf[q-p] = 0; - } - else - { - workbuf[q-p] = '\r'; - workbuf[q-p+1] = '\n'; - workbuf[q-p+2] = 0; - } - p = q+1; - } - else - { - workbuf[q-p] = 0; - p = q; - } - SendMessage(edctl, EM_REPLACESEL, 0, (LPARAM)workbuf); - } - linesafter = SendMessage(edctl, EM_GETLINECOUNT, 0,0); - SendMessage(edctl, EM_LINESCROLL, 0, linesafter-linesbefore); - if (vis) SendMessage(edctl, WM_SETREDRAW, TRUE,0); - return 0; -} - -int32_t startwin_settitle(const char *str) -{ - if (!startupdlg) return 1; - SetWindowText(startupdlg, str); - return 0; -} - -int32_t startwin_idle(void *v) -{ - if (!startupdlg || !IsWindow(startupdlg)) return 0; - if (IsDialogMessage(startupdlg, (MSG *)v)) return 1; - return 0; -} - -int32_t startwin_run(void) -{ - MSG msg; - if (!startupdlg) return 1; - - done = -1; - - SetPage(TAB_CONFIG); - EnableConfig(1); - - settings.fullscreen = fullscreen; - settings.xdim2d = xdim2d; - settings.ydim2d = ydim2d; - settings.xdim3d = xdimgame; - settings.ydim3d = ydimgame; - settings.bpp3d = bppgame; - settings.forcesetup = forcesetup; - PopulateForm(); - - while (done < 0) - { - switch (GetMessage(&msg, NULL, 0,0)) - { - case 0: - done = 1; break; - case -1: - return -1; - default: - if (IsWindow(startupdlg) && IsDialogMessage(startupdlg, &msg)) break; - TranslateMessage(&msg); - DispatchMessage(&msg); - break; - } - } - - SetPage(TAB_MESSAGES); - EnableConfig(0); - if (done) - { - fullscreen = settings.fullscreen; - xdim2d = settings.xdim2d; - ydim2d = settings.ydim2d; - xdimgame = settings.xdim3d; - ydimgame = settings.ydim3d; - bppgame = settings.bpp3d; - forcesetup = settings.forcesetup; - } - - return done; -} - -#endif // STARTUP_SETUP_WINDOW \ No newline at end of file diff --git a/source/build/src/wiibits.cpp b/source/build/src/wiibits.cpp deleted file mode 100644 index 596217dd2..000000000 --- a/source/build/src/wiibits.cpp +++ /dev/null @@ -1,560 +0,0 @@ - -#include "wiibits.h" -#include "baselayer.h" -#include "common.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // for bool - -#include "vfs.h" - -#ifdef __cplusplus -extern "C" { -#endif - -extern buildvfs_FILE osdlog; - -extern void L2Enhance(); -extern void CON_EnableGecko(int channel,int safe); -extern bool fatInit(uint32_t cacheSize, bool setAsDefaultDevice); - -extern void WII_InitVideoSystem(void); - -extern unsigned char *xfb; -extern GXRModeObj *vmode; - -#ifdef __cplusplus -} -#endif - -enum -{ - Black = 0, - Red = 1, - Green = 2, - Yellow = 3, - Blue = 4, - Magenta = 5, - Cyan = 6, - White = 7 -}; - -static void ConsoleColor(uint8_t bgcolor, uint8_t bgbold, uint8_t fgcolor, uint8_t fgbold) -{ - Bprintf("\x1b[%u;%dm\x1b[%u;%dm", fgcolor + 30, fgbold, bgcolor + 40, bgbold); -} - -static void print_centered(const int32_t width, const char *part1, const char *part2) -{ - const int32_t length = Bstrlen(part1) + Bstrlen(part2) + 1; - const int32_t leftbuf = (width-1 - length) / 2; - const int32_t rightbuf = width-1 - leftbuf - length; - - Bprintf("%*s%s %s%*s\n", leftbuf, " ", part1, part2, rightbuf, " "); -} - -void wii_open(void) -{ - struct { int x, y; } ConsoleExtent; - - L2Enhance(); - CON_EnableGecko(1, 1); - Bprintf("Console started\n"); - fatInit(28, true); - - // init the console for the title bar - CON_InitEx(vmode, 0, 12, vmode->viWidth, 68); - ConsoleColor(Blue, 0, White, 0); - - CON_GetMetrics(&ConsoleExtent.x, &ConsoleExtent.y); - print_centered(ConsoleExtent.x, AppProperName, s_buildRev); - print_centered(ConsoleExtent.x, "Built", s_buildTimestamp); - - VIDEO_WaitVSync(); - if (vmode->viTVMode&VI_NON_INTERLACE) - VIDEO_WaitVSync(); - - // reinit console below the title bar - CON_InitEx(vmode, 8, 50, vmode->viWidth - 16, vmode->viHeight - 62); - ConsoleColor(Black, 0, White, 0); -} - -// Reset the video system to remove the startup console. -void wii_initgamevideo(void) -{ - WII_InitVideoSystem(); -} - -/* - * linux/lib/vsprintf.c - * - * Copyright (C) 1991, 1992 Linus Torvalds - */ - -/* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */ -/* - * Wirzenius wrote this portably, Torvalds fucked it up :-) - */ - -/* we use this so that we can do without the ctype library */ -#define is_digit(c) ((c) >= '0' && (c) <= '9') - -static int skip_atoi(const char **s) -{ - int i=0; - - while (is_digit(**s)) - i = i*10 + *((*s)++) - '0'; - return i; -} - -#define ZEROPAD 1 /* pad with zero */ -#define SIGN 2 /* unsigned/signed long */ -#define PLUS 4 /* show plus */ -#define SPACE 8 /* space if plus */ -#define LEFT 16 /* left justified */ -#define SPECIAL 32 /* 0x */ -#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */ - -#define do_div(n,base) ({ \ -int __res; \ -__res = ((unsigned long) n) % (unsigned) base; \ -n = ((unsigned long) n) / (unsigned) base; \ -__res; }) - -static char * number(char * str, long num, int base, int size, int precision - ,int type) -{ - char c,sign,tmp[66]; - const char *digits="0123456789abcdefghijklmnopqrstuvwxyz"; - int i; - - if (type & LARGE) - digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - if (type & LEFT) - type &= ~ZEROPAD; - if (base < 2 || base > 36) - return 0; - c = (type & ZEROPAD) ? '0' : ' '; - sign = 0; - if (type & SIGN) { - if (num < 0) { - sign = '-'; - num = -num; - size--; - } else if (type & PLUS) { - sign = '+'; - size--; - } else if (type & SPACE) { - sign = ' '; - size--; - } - } - if (type & SPECIAL) { - if (base == 16) - size -= 2; - else if (base == 8) - size--; - } - i = 0; - if (num == 0) - tmp[i++]='0'; - else while (num != 0) - tmp[i++] = digits[do_div(num,base)]; - if (i > precision) - precision = i; - size -= precision; - if (!(type&(ZEROPAD+LEFT))) - while(size-->0) - *str++ = ' '; - if (sign) - *str++ = sign; - if (type & SPECIAL) { - if (base==8) - *str++ = '0'; - else if (base==16) { - *str++ = '0'; - *str++ = digits[33]; - } - } - if (!(type & LEFT)) - while (size-- > 0) - *str++ = c; - while (i < precision--) - *str++ = '0'; - while (i-- > 0) - *str++ = tmp[i]; - while (size-- > 0) - *str++ = ' '; - return str; -} - -static int exception_vsprintf(char *buf, const char *fmt, va_list args) -{ - int len; - unsigned long num; - int i, base; - char * str; - const char *s; - - int flags; /* flags to number() */ - - int field_width; /* width of output field */ - int precision; /* min. # of digits for integers; max - number of chars for from string */ - int qualifier; /* 'h', 'l', or 'L' for integer fields */ - - for (str=buf ; *fmt ; ++fmt) { - if (*fmt != '%') { - *str++ = *fmt; - continue; - } - - /* process flags */ - flags = 0; - repeat: - ++fmt; /* this also skips first '%' */ - switch (*fmt) { - case '-': flags |= LEFT; goto repeat; - case '+': flags |= PLUS; goto repeat; - case ' ': flags |= SPACE; goto repeat; - case '#': flags |= SPECIAL; goto repeat; - case '0': flags |= ZEROPAD; goto repeat; - } - - /* get field width */ - field_width = -1; - if (is_digit(*fmt)) - field_width = skip_atoi(&fmt); - else if (*fmt == '*') { - ++fmt; - /* it's the next argument */ - field_width = va_arg(args, int); - if (field_width < 0) { - field_width = -field_width; - flags |= LEFT; - } - } - - /* get the precision */ - precision = -1; - if (*fmt == '.') { - ++fmt; - if (is_digit(*fmt)) - precision = skip_atoi(&fmt); - else if (*fmt == '*') { - ++fmt; - /* it's the next argument */ - precision = va_arg(args, int); - } - if (precision < 0) - precision = 0; - } - - /* get the conversion qualifier */ - qualifier = -1; - if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L') { - qualifier = *fmt; - ++fmt; - } - - /* default base */ - base = 10; - - switch (*fmt) { - case 'c': - if (!(flags & LEFT)) - while (--field_width > 0) - *str++ = ' '; - *str++ = (unsigned char) va_arg(args, int); - while (--field_width > 0) - *str++ = ' '; - continue; - - case 's': - s = va_arg(args, char *); - if (!s) - s = ""; - - len = strnlen(s, precision); - - if (!(flags & LEFT)) - while (len < field_width--) - *str++ = ' '; - for (i = 0; i < len; ++i) - *str++ = *s++; - while (len < field_width--) - *str++ = ' '; - continue; - - case 'p': - if (field_width == -1) { - field_width = 2*sizeof(void *); - flags |= ZEROPAD; - } - str = number(str, - (unsigned long) va_arg(args, void *), 16, - field_width, precision, flags); - continue; - - - case 'n': - if (qualifier == 'l') { - long * ip = va_arg(args, long *); - *ip = (str - buf); - } else { - int * ip = va_arg(args, int *); - *ip = (str - buf); - } - continue; - - case '%': - *str++ = '%'; - continue; - - /* integer number formats - set up the flags and "break" */ - case 'o': - base = 8; - break; - - case 'X': - flags |= LARGE; - case 'x': - base = 16; - break; - - case 'd': - case 'i': - flags |= SIGN; - case 'u': - break; - - default: - *str++ = '%'; - if (*fmt) - *str++ = *fmt; - else - --fmt; - continue; - } - if (qualifier == 'l') - num = va_arg(args, unsigned long); - else if (qualifier == 'h') { - num = (unsigned short) va_arg(args, int); - if (flags & SIGN) - num = (short) num; - } else if (flags & SIGN) - num = va_arg(args, int); - else - num = va_arg(args, unsigned int); - str = number(str, num, base, field_width, precision, flags); - } - *str = '\0'; - return str-buf; -} - - -#define DOUTBUFSIZE 256 - -static int exception_output; - -static void exception_printf(const char *str, ...) -{ - char outstr[DOUTBUFSIZE]; - - int len; - - va_list args; - - va_start(args, str); - len = exception_vsprintf(outstr, str, args); - va_end(args); - - if (exception_output) - Bfputs(outstr, osdlog); - else - Bwrite(2, outstr, len); -} - - -/*------------------------------------------------------------- - -exception.c -- PPC exception handling support - -Copyright (C) 2004 -Michael Wiedenbauer (shagkur) -Dave Murphy (WinterMute) - -Copyright (C) 2014 -Modified for EDuke32 - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you -must not claim that you wrote the original software. If you use -this software in a product, an acknowledgment in the product -documentation would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. - --------------------------------------------------------------*/ - -//#define _EXC_DEBUG - -#define CPU_STACK_TRACE_DEPTH 10 - -typedef struct _framerec { - struct _framerec *up; - void *lr; -} frame_rec, *frame_rec_t; - -static void *exception_xfb = (void*)0xC1700000; //we use a static address above ArenaHi. - -#ifdef __cplusplus -extern "C" { -#endif - -extern void udelay(int us); -extern void __reload(); -extern void VIDEO_SetFramebuffer(void *); -extern void __console_init(void *framebuffer,int xstart,int ystart,int xres,int yres,int stride); - -extern void __wrap_c_default_exceptionhandler(frame_context *pCtx); - -#ifdef __cplusplus -} -#endif - -static const char *exception_name[NUM_EXCEPTIONS] = { - "System Reset", "Machine Check", "DSI", "ISI", - "Interrupt", "Alignment", "Program", "Floating Point", - "Decrementer", "System Call", "Trace", "Performance", - "IABR", "Reserved", "Thermal"}; - - -extern void __wrap_c_default_exceptionhandler(frame_context *pCtx); - -static void _cpu_print_stack(void *pc,void *lr,void *r1) -{ - u32 i = 0; - frame_rec_t l,p = (frame_rec_t)lr; - - l = p; - p = (frame_rec_t)r1; - if(!p) __asm__ __volatile__("mr %0,%%r1" : "=r"(p)); - - exception_printf("\n\tSTACK DUMP:"); - - for(i=0;iup;p=p->up,i++) { - if(i%4) exception_printf(" --> "); - else { - if(i>0) exception_printf(" -->\n\t"); - else exception_printf("\n\t"); - } - - switch(i) { - case 0: - if(pc) exception_printf("%p",pc); - break; - case 1: - if(!l) l = (frame_rec_t)mfspr(8); - exception_printf("%p",(void*)l); - break; - default: - exception_printf("%p",(void*)(p->up->lr)); - break; - } - } -} - -static void waitForReload(void) -{ - u32 level; - - exception_printf("\tPress the Reset button to return to loader.\n\n"); - - while ( 1 ) - { - if( SYS_ResetButtonDown() ) - { - exception_printf("\tReturning to loader...\n"); - _CPU_ISR_Disable(level); - __reload (); - } - - udelay(20000); - } -} - -void __wrap_c_default_exceptionhandler(frame_context *pCtx) -{ - GX_AbortFrame(); - VIDEO_SetFramebuffer(exception_xfb); - __console_init(exception_xfb,20,20,640,574,1280); - CON_EnableGecko(1, true); - - exception_printf("\n\n\n"); - - if (osdlog && osdlogfn) - { - exception_printf("\tAn unrecoverable error has occurred.\n\tPlease submit \"%s\" to the %s developers.\n\n", osdlogfn, AppProperName); - exception_output = 1; - } - - exception_printf("\tException: %s\n\n", exception_name[pCtx->EXCPT_Number]); - exception_printf("\tGPR00 %08X GPR08 %08X GPR16 %08X GPR24 %08X\n",pCtx->GPR[0], pCtx->GPR[8], pCtx->GPR[16], pCtx->GPR[24]); - exception_printf("\tGPR01 %08X GPR09 %08X GPR17 %08X GPR25 %08X\n",pCtx->GPR[1], pCtx->GPR[9], pCtx->GPR[17], pCtx->GPR[25]); - exception_printf("\tGPR02 %08X GPR10 %08X GPR18 %08X GPR26 %08X\n",pCtx->GPR[2], pCtx->GPR[10], pCtx->GPR[18], pCtx->GPR[26]); - exception_printf("\tGPR03 %08X GPR11 %08X GPR19 %08X GPR27 %08X\n",pCtx->GPR[3], pCtx->GPR[11], pCtx->GPR[19], pCtx->GPR[27]); - exception_printf("\tGPR04 %08X GPR12 %08X GPR20 %08X GPR28 %08X\n",pCtx->GPR[4], pCtx->GPR[12], pCtx->GPR[20], pCtx->GPR[28]); - exception_printf("\tGPR05 %08X GPR13 %08X GPR21 %08X GPR29 %08X\n",pCtx->GPR[5], pCtx->GPR[13], pCtx->GPR[21], pCtx->GPR[29]); - exception_printf("\tGPR06 %08X GPR14 %08X GPR22 %08X GPR30 %08X\n",pCtx->GPR[6], pCtx->GPR[14], pCtx->GPR[22], pCtx->GPR[30]); - exception_printf("\tGPR07 %08X GPR15 %08X GPR23 %08X GPR31 %08X\n",pCtx->GPR[7], pCtx->GPR[15], pCtx->GPR[23], pCtx->GPR[31]); - exception_printf("\tLR %08X SRR0 %08x SRR1 %08x MSR %08x\n", pCtx->LR, pCtx->SRR0, pCtx->SRR1,pCtx->MSR); - exception_printf("\tDAR %08X DSISR %08X\n", mfspr(19), mfspr(18)); - - _cpu_print_stack((void*)pCtx->SRR0,(void*)pCtx->LR,(void*)pCtx->GPR[1]); - - if((pCtx->EXCPT_Number==EX_DSI) || (pCtx->EXCPT_Number==EX_FP)) { - u32 i; - u32 *pAdd = (u32*)pCtx->SRR0; - exception_printf("\n\n\tCODE DUMP:\n"); - for (i=0; i<12; i+=4) - exception_printf("\t%p: %08X %08X %08X %08X\n", - &(pAdd[i]),pAdd[i], pAdd[i+1], pAdd[i+2], pAdd[i+3]); - } - - if (exception_output) - { - exception_output = 0; - MAYBE_FCLOSE_AND_NULL(osdlog); - } - else - { - exception_printf("\n"); - } - - waitForReload(); - - return; -}