int get_temperature_celcius(uint32_t cpu_temp, uint32_t rsx_temp) { sys_game_get_temperature(0, &cpu_temp); sys_game_get_temperature(1, &rsx_temp); cpu_temp=cpu_temp>>24; rsx_temp=rsx_temp>>24; return 0; }
unsigned ps3pad_read() { int n; padActParam actparam; unsigned butt = 0; pad_alive = 0; static int count = 16; static u64 sec, nsec; count++; if(count > 15) { sysGetCurrentTime(&sec, &nsec); count = 0; if(pad_last_time == 0) pad_last_time = sec; if(iTimeoutByInactivity) { if((sec - pad_last_time) > (iTimeoutByInactivity * 3600)) { if(DrawDialogYesNoTimer("System will be shutdown in two minutes by inactivity\nDo you want to abort the countdown?", 120000.0f) != 1) { fun_exit(); sys_shutdown(); exit(0); } else pad_last_time = 0; } } u32 temp = 0; u32 temp2 = 0; sys_game_get_temperature(0, &temp); sys_game_get_temperature(1, &temp2); if((temp >= 80 || temp2 >= 80)) { if(!hot_temp_alarm) hot_temp_alarm = sec; } else hot_temp_alarm = 0; if(hot_temp_alarm && (sec - hot_temp_alarm) > 90) { DrawDialogOKTimer("WARNING: CPU/RSX Temperature is too high!\nSystem will be shutdown in 10 seconds\n", 10000.0f); fun_exit(); sys_shutdown(); exit(0); } } sysUtilCheckCallback(); ioPadGetInfo(&padinfo); for(n = 0; n < MAX_PADS; n++) { if(padinfo.status[n]) { ioPadGetData(n, &paddata); pad_alive = 1; butt = (paddata.button[2] << 8) | (paddata.button[3] & 0xff); /* Analog stick management */ if (paddata.button[6] < 0x10) butt |= BUTTON_LEFT; else if (paddata.button[6] > 0xe0) butt |= BUTTON_RIGHT; if (paddata.button[7] < 0x10) butt |= BUTTON_UP; else if (paddata.button[7] > 0xe0) butt |= BUTTON_DOWN; if(butt) pad_last_time = sec; break; } } if(!pad_alive) butt = 0; else { actparam.small_motor = 0; actparam.large_motor = 0; if(rumble1_on) { actparam.large_motor = 255; rumble1_on++; if(rumble1_on > 15) rumble1_on = 0; } if(rumble2_on) { actparam.small_motor = 1; rumble2_on++; if(rumble2_on > 10) rumble2_on = 0; } last_rumble = n; ioPadSetActDirect(n, &actparam); } temp_pad = butt; new_pad = temp_pad & (~old_pad); old_pad = temp_pad; return butt; }
void render(bool bClearOnly) { glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if(bClearOnly == false) { textures[0]->Render(0,0,0,0); // ============================================================================================= // TITLE // ============================================================================================= double xPos, yPos; xPos = DbgFontCenterX( 0, // x left (as in RECT) render_width, // x right (as in RECT) FONT_SIZE_1, // font size (in pixels) strlen(szTitle), // text length (num. chars) REFERENCE_WIDTH, REFERENCE_HEIGHT, // reference width / height (should not be changed) render_width, render_height // currently active resolution ); yPos = DbgFontY(50.0, render_height); cellDbgFontPrintf(xPos, yPos, debug_font_size(FONT_SIZE_1), 0xFFFFFFFF, "%s", szTitle); yPos += DbgFontY(FONT_SIZE_1 + FONT_SPACING, render_height); // ============================================================================================= // DATE // ============================================================================================= char szDate[128]; char szTime[128]; memset(&szDate, 0, sizeof(szDate)); memset(&szTime, 0, sizeof(szTime)); GetDateTimeStr((char*)szDate, (char*)szTime, false); xPos = DbgFontCenterX( 0, // x left (as in RECT) render_width, // x right (as in RECT) FONT_SIZE_2, // font size (in pixels) strlen(szDate), // text length (num. chars) REFERENCE_WIDTH, REFERENCE_HEIGHT, // reference width / height (should not be changed) render_width, render_height // currently active resolution ); cellDbgFontPrintf(xPos, yPos, debug_font_size(FONT_SIZE_2), 0xFFFFFFFF, "%s", szDate); yPos += DbgFontY(FONT_SIZE_2 + FONT_SPACING, render_height); // ============================================================================================= // TIME // ============================================================================================= xPos = DbgFontCenterX( 0, // x left (as in RECT) render_width, // x right (as in RECT) FONT_SIZE_1, // font size (in pixels) strlen(szTime), // text length (num. chars) REFERENCE_WIDTH, REFERENCE_HEIGHT, // reference width / height (should not be changed) render_width, render_height // currently active resolution ); cellDbgFontPrintf(xPos, yPos, debug_font_size(FONT_SIZE_1), 0xFFFFFFFF, "%s", szTime); yPos += DbgFontY(FONT_SIZE_1 + FONT_SPACING, render_height); // ============================================================================================= static uint64_t nInterval = 30; // 0.5 second @ 60 FPS static uint64_t nFrameCheckpoint = nFrame; if(nFrame >= (nFrameCheckpoint + nInterval)) { nFrameCheckpoint = nFrame; sys_game_get_temperature(0, &temp_cpu); sys_game_get_temperature(1, &temp_rsx); } char szTemperature[256]; memset(&szTemperature, 0, sizeof(szTemperature)); sprintf(szTemperature, "Temperature: (CPU: %d' C) (RSX: %d' C)", temp_cpu, temp_rsx); xPos = DbgFontCenterX( 0, // x left (as in RECT) render_width, // x right (as in RECT) FONT_SIZE_2, // font size (in pixels) strlen(szTemperature), // text length (num. chars) REFERENCE_WIDTH, REFERENCE_HEIGHT, // reference width / height (should not be changed) render_width, render_height // currently active resolution ); cellDbgFontPrintf(xPos, yPos, debug_font_size(FONT_SIZE_2), 0xFFFFFFFF, "%s", szTemperature); yPos += DbgFontY(FONT_SIZE_2 + FONT_SPACING, render_height); // === yPos += DbgFontY(FONT_SIZE_2 + FONT_SPACING, render_height); yPos += DbgFontY(FONT_SIZE_2 + FONT_SPACING, render_height); // === //xPos = DbgFontCenterX( // 0, // x left (as in RECT) // render_width, // x right (as in RECT) // FONT_SIZE_2, // font size (in pixels) // strlen((char*)"..::[ ISO LIST ] [ PS3ISO / PSXISO / BDISO / DVDISO ] ::.."), // text length (num. chars) // REFERENCE_WIDTH, REFERENCE_HEIGHT, // reference width / height (should not be changed) // render_width, render_height // currently active resolution //); // //cellDbgFontPrintf(xPos, yPos, debug_font_size(FONT_SIZE_2), 0xFFFFFFFF, "%s", (char*)"..::[ ISO LIST ] [ PS3ISO / PSXISO / BDISO / DVDISO ] ::.."); // yPos += DbgFontY(FONT_SIZE_2 + FONT_SPACING, render_height); yPos += DbgFontY(FONT_SIZE_2 + FONT_SPACING, render_height); // ================ xPos = DbgFontX(100.0, render_width); int nMenuItem = main_menu->UpdateTopItem(); while(nMenuItem <= (main_menu->nTopItem + main_menu->nListMax)) { if(nMenuItem == main_menu->nTotalItem) break; if(main_menu->nTotalItem <= 0) break; // normal unsigned int nColor = 0xFFFFFFFF; // selected if(nMenuItem == main_menu->nSelectedItem) { nColor = 0xFF00CCFF; } //if(nFrameStep == 0) { nColor = g_opt_nFontShadowColor; } // Shadow color cellDbgFontPrintf(xPos, yPos, debug_font_size(FONT_SIZE_2), nColor, "%s", main_menu->item[nMenuItem]->szMenuLabel/*, main_menu->item[nMenuItem]->szData_1*/); yPos += DbgFontY(FONT_SIZE_2 + FONT_SPACING, render_height); nMenuItem++; } (void)font_render(); } nFrame++; psglSwap(); }