MFInitStatus MFCallstack_InitModule(int moduleId, bool bPerformInitialisation) { #if defined(_MFCALLSTACK_PROFILING) DebugMenu_AddItem("Draw Callstack Profile", "Fuji Options", &drawCallstack); DebugMenu_AddItem("Draw Profile Meter", "Fuji Options", &drawCallstackMeter); #endif return MFIS_Succeeded; }
MFInitStatus MFCallstack_InitModule() { #if defined(_MFCALLSTACK_PROFILING) DebugMenu_AddItem("Draw Callstack Profile", "Fuji Options", &drawCallstack); DebugMenu_AddItem("Draw Profile Meter", "Fuji Options", &drawCallstackMeter); #endif return MFAIC_Succeeded; }
void MFDisplay_InitModulePlatformSpecific() { MFZeroMemory(gXKeys, sizeof(gXKeys)); MFZeroMemory(&gXMouse, sizeof(gXMouse)); gXMouse.x = -1; // gNumDisplayDevices = 0; // gpDisplayAdaptors = (MFDisplayAdaptorDesc*)MFHeap_Alloc(sizeof(MFDisplayAdaptorDesc)*0); xdisplay = XOpenDisplay(NULL); if(!xdisplay) { MFDebug_Error("Unable to open display"); return; } screen = DefaultScreen(xdisplay); rootWindow = RootWindow(xdisplay, screen); wm_delete_window = XInternAtom(xdisplay, "WM_DELETE_WINDOW", false); // build our internal list of available video modes /* GetModes(&modes, false);//!gDisplay.windowed); while(!FindMode(modes, width, height)) { if(!gDisplay.windowed) { // no fullscreen mode, try windowed mode instead MFDebug_Warn(1, "No suitable modes for fullscreen mode, trying windowed mode"); gDisplay.windowed = true; FreeModes(); GetModes(&modes, false); } else { // default is some sort of custom mode that doesn't appear in the windowed mode list // HACK: we'll add it to the end.. modes[numModes].width = width; modes[numModes].height = height; currentMode = numModes; ++numModes; break; } } */ DebugMenu_AddItem("Resolution", "Display Options", &resSelect, ChangeResCallback); DebugMenu_AddItem("Apply", "Display Options", &applyDisplayMode, ApplyDisplayModeCallback); }
MFInitStatus MFCollision_InitModule() { gItemList.Init("Collision Items", 256); DebugMenu_AddItem("Show Collision", "Fuji Options", &gShowCollision, NULL, NULL); return MFAIC_Succeeded; }
MFInitStatus DebugMenu_InitModule(int moduleId, bool bPerformInitialisation) { // create root menu MFString_Copy(rootMenu.name, "root"); rootMenu.menuDepth = 0; rootMenu.numChildren = 0; rootMenu.pCallback = NULL; rootMenu.pParent = NULL; rootMenu.pUserData = NULL; rootMenu.selection = 0; DebugMenu_AddMenuTo("Fuji Options", &rootMenu); DebugMenu_AddMenu("Debug Menu Options", "Fuji Options"); DebugMenu_AddItem("Menu Position", "Debug Menu Options", &menuPos); DebugMenu_AddItem("Menu Dimensions", "Debug Menu Options", &menuDim); DebugMenu_AddItem("Menu Colour", "Debug Menu Options", &menuCol); DebugMenu_AddItem("Menu Item Colour", "Debug Menu Options", &menuItemCom); return MFIS_Succeeded; }
MFInitStatus Timer_InitModule() { DebugMenu_AddItem("Game Playback Rate", "Fuji Options", &playRate, UpdateRate); return MFAIC_Succeeded; }
int MFDisplay_CreateDisplay(int width, int height, int bpp, int rate, bool vsync, bool triplebuffer, bool wide, bool progressive) { MFCALLSTACK; MFZeroMemory(gXKeys, sizeof(gXKeys)); MFZeroMemory(&gXMouse, sizeof(gXMouse)); gXMouse.x = -1; gDisplay.fullscreenWidth = gDisplay.width = width; gDisplay.fullscreenHeight = gDisplay.height = height; gDisplay.refreshRate = 0; gDisplay.colourDepth = 0; /* Use default. Chances are, it's something sane */ gDisplay.windowed = true; gDisplay.wide = false; gDisplay.progressive = true; if(!(xdisplay = XOpenDisplay(NULL))) { MFDebug_Error("Unable to open display"); MFDisplay_DestroyDisplay(); return 1; } screen = DefaultScreen(xdisplay); rootWindow = RootWindow(xdisplay, screen); // build our internal list of available video modes GetModes(&modes, !gDisplay.windowed); while(!FindMode(modes, width, height)) { if(!gDisplay.windowed) { // no fullscreen mode, try windowed mode instead MFDebug_Warn(1, "No suitable modes for fullscreen mode, trying windowed mode"); gDisplay.windowed = true; FreeModes(); GetModes(&modes, false); } else { // default is some sort of custom mode that doesn't appear in the windowed mode list // HACK: we'll add it to the end.. modes[numModes].width = width; modes[numModes].height = height; currentMode = numModes; ++numModes; break; } } DebugMenu_AddItem("Resolution", "Display Options", &resSelect, ChangeResCallback); DebugMenu_AddItem("Apply", "Display Options", &applyDisplayMode, ApplyDisplayModeCallback); // Set full screen mode, if necessary if(!gDisplay.windowed && numModes > 1) { if(!XF86VidModeSwitchToMode(xdisplay, screen, vidModes[currentMode])) { MFDebug_Error("Unable to switch screenmodes, defaulting to windowed mode"); MFDisplay_DestroyDisplay(); return 1; } } XVisualInfo *MFRenderer_GetVisualInfo(); XVisualInfo *visualInfo = MFRenderer_GetVisualInfo(); if(!visualInfo) return 1; if(!(colorMap = XCreateColormap(xdisplay, rootWindow, visualInfo->visual, AllocNone))) { MFDebug_Error("Unable to create colourmap"); XFree(visualInfo); MFDisplay_DestroyDisplay(); return 1; } XSetWindowAttributes windowAttrs; windowAttrs.colormap = colorMap; windowAttrs.cursor = None; windowAttrs.event_mask = StructureNotifyMask; windowAttrs.border_pixel = BlackPixel(xdisplay, screen); windowAttrs.background_pixel = BlackPixel(xdisplay, screen); if(!(window = XCreateWindow(xdisplay, rootWindow, 0, 0, width, height, 0, visualInfo->depth, InputOutput, visualInfo->visual, CWBackPixel | CWBorderPixel | CWCursor | CWColormap | CWEventMask, &windowAttrs))) { MFDebug_Error("Unable to create X Window"); XFree(visualInfo); MFDisplay_DestroyDisplay(); return 1; } // Tell the window manager not to allow our window to be resized. But some window managers can ignore me and do it anyway. Typical X-Windows. if((sizeHints = XAllocSizeHints()) == NULL) { MFDebug_Error("Unable to alloc XSizeHints structure, out of memory?"); XFree(visualInfo); MFDisplay_DestroyDisplay(); return 1; } sizeHints->flags = PSize | PMinSize | PMaxSize; sizeHints->min_width = sizeHints->max_width = sizeHints->base_width = width; sizeHints->min_height = sizeHints->max_height = sizeHints->base_height = height; XSetWMNormalHints(xdisplay, window, sizeHints); // Window title XStoreName(xdisplay, window, gDefaults.display.pWindowTitle); XWMHints *wmHints; if((wmHints = XAllocWMHints()) == NULL) { MFDebug_Error("Unable to alloc XWMHints structure, out of memory?"); XFree(visualInfo); MFDisplay_DestroyDisplay(); return 1; } wmHints->flags = InputHint | StateHint; wmHints->input = true; wmHints->initial_state = NormalState; if(!XSetWMHints(xdisplay, window, wmHints)) { MFDebug_Error("Unable to set WM hints for window"); XFree(visualInfo); MFDisplay_DestroyDisplay(); return 1; } XFree(wmHints); XFree(visualInfo); // Tell the window manager that I want to be notified if the window's closed wm_delete_window = XInternAtom(xdisplay, "WM_DELETE_WINDOW", false); if(!XSetWMProtocols(xdisplay, window, &wm_delete_window, 1)) { MFDebug_Error("Unable to set Window Manager protocols"); MFDisplay_DestroyDisplay(); return 1; } XSelectInput(xdisplay, window, KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask | ExposureMask); if(!XMapRaised(xdisplay, window)) { MFDebug_Error("Unable to map new window"); MFDisplay_DestroyDisplay(); return 1; } // Wait for the window to be mapped, etc. The documentation doesn't indicate that this is necessary, but every GLX program I've ever seen does it, so I assume it is. XEvent event; XIfEvent(xdisplay, &event, WaitForNotify, (char *)window); MFRenderer_CreateDisplay(); if(!gDisplay.windowed && numModes > 1) { if(!XF86VidModeSwitchToMode(xdisplay, screen, vidModes[currentMode])) { MFDebug_Error("Unable to set screen mode"); MFDisplay_DestroyDisplay(); return 1; } XGrabPointer(xdisplay, window, True, ButtonPressMask, GrabModeAsync, GrabModeAsync, window, None, CurrentTime); XFlush(xdisplay); // A little trick to make sure the entire window is on the screen XWarpPointer(xdisplay, None, window, 0, 0, 0, 0, width - 1, height - 1); XWarpPointer(xdisplay, None, window, 0, 0, 0, 0, 0, 0); XFlush(xdisplay); } return 0; }
MFInitStatus MFMaterial_InitModule() { MFCALLSTACK; gMaterialRegistry.Init("Material Registry", gDefaults.material.maxMaterialTypes); gMaterialDefList.Init("Material Definitions List", gDefaults.material.maxMaterialDefs); gMaterialList.Init("Material List", gDefaults.material.maxMaterials); DebugMenu_AddItem("Material Browser", "Fuji Options", &matBrowser); MFMat_Standard_Register(); MFMat_Effect_Register(); if(MFFileSystem_Exists("Materials.ini") && MFMaterial_AddDefinitionsFile("Materials", "Materials")) { MFDebug_Warn(3, "Failed to load Materials.ini"); } #if MF_RENDERER == MF_DRIVER_D3D11 || defined(MF_RENDERPLUGIN_D3D11) // HACK? MFTexture *pSysLogoLargeTexture = MFTexture_Create("_None"); MFTexture *pSysLogoSmallTexture = MFTexture_Create("_None"); #else // create the logo textures from raw data MFTexture *pSysLogoLargeTexture = MFTexture_CreateFromRawData("SysLogoLarge", SysLogo256_data, SysLogo256_width, SysLogo256_height, (MFImageFormat)SysLogo256_format, SysLogo256_flags); MFTexture *pSysLogoSmallTexture = MFTexture_CreateFromRawData("SysLogoSmall", SysLogo64_data, SysLogo64_width, SysLogo64_height, (MFImageFormat)SysLogo64_format, SysLogo64_flags); #endif // create standard materials pNoneMaterial = MFMaterial_Create("_None"); pWhiteMaterial = MFMaterial_Create("_White"); pSysLogoLarge = MFMaterial_Create("SysLogoLarge"); pSysLogoSmall = MFMaterial_Create("SysLogoSmall"); // disable backface cullign on the default materials MFMaterial_SetParameterI(pNoneMaterial, MFMatStandard_CullMode, 0, MFMatStandard_Cull_None); MFMaterial_SetParameterI(pWhiteMaterial, MFMatStandard_CullMode, 0, MFMatStandard_Cull_None); // release a reference to the logo textures MFTexture_Destroy(pSysLogoLargeTexture); MFTexture_Destroy(pSysLogoSmallTexture); #if defined(_PSP) // create PSP specific stock materials MFTexture *pConnectedTexture = MFTexture_CreateFromRawData("connected", connected_data, connected_width, connected_height, (MFImageFormat)connected_format, connected_flags); MFTexture *pDisconnectedTexture = MFTexture_CreateFromRawData("disconnected", disconnected_data, disconnected_width, disconnected_height, (MFImageFormat)disconnected_format, disconnected_flags); MFTexture *pPowerTexture = MFTexture_CreateFromRawData("power", power_data, power_width, power_height, (MFImageFormat)power_format, power_flags); MFTexture *pChargingTexture = MFTexture_CreateFromRawData("charging", charging_data, charging_width, charging_height, (MFImageFormat)charging_format, charging_flags); MFTexture *pUSBTexture = MFTexture_CreateFromRawData("usb_icon", usb_icon_data, usb_icon_width, usb_icon_height, (MFImageFormat)usb_icon_format, usb_icon_flags); pConnected = MFMaterial_Create("connected"); pDisconnected = MFMaterial_Create("disconnected"); pPower = MFMaterial_Create("power"); pCharging = MFMaterial_Create("charging"); pUSB = MFMaterial_Create("usb_icon"); MFTexture_Destroy(pConnectedTexture); MFTexture_Destroy(pDisconnectedTexture); MFTexture_Destroy(pPowerTexture); MFTexture_Destroy(pChargingTexture); MFTexture_Destroy(pUSBTexture); #endif return MFAIC_Succeeded; }
MFInitStatus Timer_InitModule(int moduleId, bool bPerformInitialisation) { DebugMenu_AddItem("Game Playback Rate", "Fuji Options", &playRate, UpdateRate); return MFIS_Succeeded; }