예제 #1
0
파일: hexpad.c 프로젝트: opalmirror/cefive
static int render_digit(HexPad* prPad, const int x, const int y) {
    CursorPos* prPos = NULL;
    ColorConfig* prColor = NULL;
    int vx = 0;
    int vy = 0;
    int digit = 0;
    
    if (prPad == NULL) {
        return HEXPAD_NULLPTR;
    }
    digit = (4 * y) + x;
    prPos = hexpad_get_position(prPad);
    vx = prPos->x + (x * 3);
    vy = prPos->y + (y * 3);
    prColor = digit_color(prPad, x, y);
    if (prColor != NULL) {
        pspDebugScreenSetBackColor(prColor->background);
        pspDebugScreenSetTextColor(prColor->text);
    }
    pspDebugScreenSetXY(vx, vy);
    pspDebugScreenPuts("   ");
    pspDebugScreenSetXY(vx, vy + 1);
    pspDebugScreenKprintf(" %X ", digit);
    pspDebugScreenSetXY(vx, vy + 2);
    pspDebugScreenPuts("   ");
    return HEXPAD_SUCCESS;
}
예제 #2
0
static int render_panelcolor_row(OptionsPanel* prPanel) {
    CursorPos* prPos = NULL;
    CursorPos* prCursor = NULL;
    ColorConfig* prPcolor = NULL;
    ColorConfig* prCcolor = NULL;
    Dimension* prSize = NULL;
    int cr = 0;
    char sFmt[10];
    
    if (prPanel == NULL) {
        return OPTIONSPANEL_NULLPTR;
    }
    
    prPos = get_position(prPanel);
    prCursor = get_cursorpos(prPanel);
    prPcolor = get_panelcolor(prPanel);
    prCcolor = get_cursorcolor(prPanel);
    prSize = get_size(prPanel);
    
    pspDebugScreenSetXY(prPos->x, prPos->y + 3);
    if (prPcolor != NULL) {
        pspDebugScreenSetBackColor(prPcolor->background);
        pspDebugScreenSetTextColor(prPcolor->text);
    }
    pspDebugScreenPuts(OPTIONSPANEL_L_PANELC);
    if (prCursor->y == 1) {
        if (prCursor->x == 0) {
            if (prCcolor != NULL) {
                pspDebugScreenSetBackColor(prCcolor->background);
                pspDebugScreenSetTextColor(prCcolor->text);
            }
        }
    }
    pspDebugScreenKprintf("0x%08X", prPcolor->background);
    if (prPcolor != NULL) {
        pspDebugScreenSetBackColor(prPcolor->background);
        pspDebugScreenSetTextColor(prPcolor->text);
    }
    pspDebugScreenPuts(" ");
    if (prCursor->y == 1) {
        if (prCursor->x == 1) {
            if (prCcolor != NULL) {
                pspDebugScreenSetBackColor(prCcolor->background);
                pspDebugScreenSetTextColor(prCcolor->text);
            }
        }
    }
    pspDebugScreenKprintf("0x%08X", prPcolor->text);
    cr = prSize->width - strlen(OPTIONSPANEL_L_PANELC) - 22;
    sprintf(sFmt, "%%-%ds", cr);
    if (prPcolor != NULL) {
        pspDebugScreenSetBackColor(prPcolor->background);
        pspDebugScreenSetTextColor(prPcolor->text);
    }
    pspDebugScreenKprintf(sFmt, "");
    return OPTIONSPANEL_SUCCESS;
}
예제 #3
0
static int drawTableRow(HexEditor* prHex, int iRow) {
    if (prHex == NULL) {
        return HEXEDITOR_MEMORY;
    }
    int tt = prHex->config.table_pos.y;
    int tl = prHex->config.table_pos.x;
    pspDebugScreenSetXY(tl, tt + iRow);
    drawAddressColumn(prHex, iRow);
    pspDebugScreenPuts(" ");
    drawDataColumns(prHex, iRow);
    pspDebugScreenPuts(" ");
    drawAsciiColumn(prHex, iRow);
    return HEXEDITOR_SUCCESS;
}
예제 #4
0
void LoadingWindow_PSP::SetText( const CString &str )
{
	// Because of direct access to VRAM,
    // this way is faster than 'pspDebugScreenClear'.
	pspDebugScreenSetXY( 0, 0 );
	pspDebugScreenSetTextColor( 0xFF000000 );
	pspDebugScreenPuts( text );

	snprintf( text, sizeof(text), "%s", str.c_str() );

	pspDebugScreenSetXY( 0, 0 );
	pspDebugScreenSetTextColor( 0xFFFFFFFF );
	pspDebugScreenPuts( text );
}
예제 #5
0
int searchpanel_redraw(SearchPanel* prPanel) {
    AppletConfig* prApCfg = NULL;
    ColorConfig* prColor = NULL;

    if (prPanel == NULL) {
        return SEARCHPANEL_MEMORY;
    }
    prApCfg = prPanel->prApCfg;

    pspDebugScreenSetXY(prPanel->config.top.x, prPanel->config.top.y);
    if (prApCfg != NULL) {
        prColor = appletconfig_get_panelcolor(prApCfg);
    } else {
        prColor = &prPanel->config.color;
    }

    pspDebugScreenSetBackColor(prColor->background);
    pspDebugScreenSetTextColor(prColor->text);
    pspDebugScreenPuts("Search Panel");
    draw_query_panel(prPanel);
    draw_button_panel(prPanel);
    draw_results_panel(prPanel);
    draw_status_panel(prPanel);
    
    return SEARCHPANEL_SUCCESS;
}
예제 #6
0
static void draw_cheat_status(CEFiveUi *prUi) {
    CEFiveConfig* prCfg = NULL;
    ColorConfig* prColor = NULL;
    if (prUi == NULL) {
        return;
    }
    prCfg = prUi->prCEConfig;
    if (prCfg != NULL) {
        prColor = cefiveconfig_get_titlecolor(prCfg);
    } else {
        prColor = &prUi->config.titlebar;
    }
    CheatEngine* prEngine = prUi->prEngine;
    int trigger = prEngine->trigger_active;
    u32 fg = (u32)0xFF0000FF;
    char* msg = "Cheats OFF";
    if (trigger == 1) {
        msg = "Cheats ON";
        fg = (u32)0xFF00FF00;
    }
    pspDebugScreenSetXY(50, 0);
    pspDebugScreenSetBackColor(prColor->background);
    pspDebugScreenSetTextColor(fg);
    pspDebugScreenPuts(msg);
}
예제 #7
0
static int render_pause_row(OptionsPanel* prPanel) {
    CursorPos* prPos = NULL;
    CursorPos* prCursor = NULL;
    ColorConfig* prPcolor = NULL;
    ColorConfig* prCcolor = NULL;
    CEFiveConfig* prConfig = NULL;
    Dimension* prSize = NULL;
    const char* sLabel = "Pause Game during UI: ";
    const char* sYes = "Yes";
    const char* sNo = "No ";
    char sFmt[10];
    
    if (prPanel == NULL) {
        return OPTIONSPANEL_NULLPTR;
    }
    prPos = get_position(prPanel);
    pspDebugScreenSetXY(prPos->x, prPos->y + 2);
    prPcolor = get_panelcolor(prPanel);
    if (prPcolor != NULL) {
        pspDebugScreenSetBackColor(prPcolor->background);
        pspDebugScreenSetTextColor(prPcolor->text);
    }
    pspDebugScreenPuts(sLabel);
    prCcolor = get_cursorcolor(prPanel);
    prCursor = get_cursorpos(prPanel);
    if (prCursor->y == 0) {
        if (prCcolor != NULL) {
            pspDebugScreenSetBackColor(prCcolor->background);
            pspDebugScreenSetTextColor(prCcolor->text);
        }
    }
    prConfig = get_cefiveconfig(prPanel);
    if (prConfig->pause_during_ui == 1) {
        pspDebugScreenPuts(sYes);
    } else {
        pspDebugScreenPuts(sNo);
    }
    if (prPcolor != NULL) {
        pspDebugScreenSetBackColor(prPcolor->background);
        pspDebugScreenSetTextColor(prPcolor->text);
    }
    prSize = get_size(prPanel);
    sprintf(sFmt, "%%-%ds", prSize->width - strlen(sLabel) - strlen(sYes) - 1);
    pspDebugScreenKprintf(sFmt, "");
    return OPTIONSPANEL_SUCCESS;
}
예제 #8
0
파일: main.c 프로젝트: FTPiano/psplinkusb
void redraw_menu(int selected)
{
	int i;

	pspDebugScreenSetXY(0, 0);
	pspDebugScreenSetTextColor(0xFFFFFFFF);
	pspDebugScreenPuts("PSPLINK Debug Menu\n\n\n");
	for(i = 0; i < opt_count; i++)
	{
		if(i == selected)
		{
			pspDebugScreenSetTextColor(0xFF00FF00);
			pspDebugScreenPuts(options[i].text);
		}
		else
		{
			pspDebugScreenSetTextColor(0xFFFFFFFF);
			pspDebugScreenPuts(options[i].text);
		}
	}
}
예제 #9
0
파일: hexview.c 프로젝트: opalmirror/cefive
static int render_value_row16(HexView* prView, const int row) {
    int col = 0;
    if (prView == NULL) {
        return HEXVIEW_NULLPTR;
    }
    for (col = 0; col < 4; col++) {
        if (render_value_col(prView, row, col) < 0) {
            return HEXVIEW_FAILURE;
        }
    }
    if (panel_color(prView) < 0) {
        return HEXVIEW_FAILURE;
    }
    pspDebugScreenPuts(" ");
    for (col = 4; col < 8; col++) {
        if (render_value_col(prView, row, col) < 0) {
            return HEXVIEW_FAILURE;
        }
    }
    if (panel_color(prView) < 0) {
        return HEXVIEW_FAILURE;
    }
    pspDebugScreenPuts(" ");
    for (col = 8; col < 12; col++) {
        if (render_value_col(prView, row, col) < 0) {
            return HEXVIEW_FAILURE;
        }
    }
    if (panel_color(prView) < 0) {
        return HEXVIEW_FAILURE;
    }
    pspDebugScreenPuts(" ");
    for (col = 12; col < 16; col++) {
        if (render_value_col(prView, row, col) < 0) {
            return HEXVIEW_FAILURE;
        }
    }
    return HEXVIEW_SUCCESS;
}
예제 #10
0
void Sys_Error (char *error, ...)
{
	char buffer[256];

	va_list		argptr;

	va_start (argptr, error);
	vsnprintf (buffer, 255, error, argptr);
	buffer[255] = '\0';
	va_end (argptr);

	pspDebugScreenInit();
	pspDebugScreenPuts("Sys_Error:\n\n");
	pspDebugScreenSetTextColor(GU_RGBA(255, 0, 0, 255));
	pspDebugScreenPuts(buffer);
	pspDebugScreenPuts("\n");

	while (go)
	{
		sceDisplayWaitVblankStart();
	}
	
	sceKernelExitGame();
}
예제 #11
0
파일: psp1_gfx.c 프로젝트: maddox/RetroArch
static bool psp_frame(void *data, const void *frame,
      unsigned width, unsigned height, unsigned pitch, const char *msg)
{
   static char fps_txt[128], fps_text_buf[128];
   psp1_video_t *psp = (psp1_video_t*)data;

#ifdef DISPLAY_FPS
   static uint64_t currentTick,lastTick;
   static float fps=0.0;
   static int frames;
#endif

   if (!width || !height)
      return false;

   if (((uint32_t)frame&0x04000000) || (frame == RETRO_HW_FRAME_BUFFER_VALID))
      psp->hw_render = true;
   else if (frame)
      psp->hw_render = false;

   if (!psp->hw_render)
      sceGuSync(0, 0); /* let the core decide when to sync when HW_RENDER */

   pspDebugScreenSetBase(psp->draw_buffer);

   pspDebugScreenSetXY(0,0);

   video_monitor_get_fps(fps_txt, sizeof(fps_txt),
         g_settings.fps_show ? fps_text_buf : NULL,
         g_settings.fps_show ? sizeof(fps_text_buf) : 0);

   if(g_settings.fps_show)
   {
      pspDebugScreenSetXY(68 - strlen(fps_text_buf) - 1,0);
      pspDebugScreenPuts(fps_text_buf);
      pspDebugScreenSetXY(0,1);
   }

   if (msg)
      pspDebugScreenPuts(msg);

   if ((psp->vsync)&&(psp->vblank_not_reached))
      sceDisplayWaitVblankStart();

   psp->vblank_not_reached = true;

#ifdef DISPLAY_FPS
   frames++;
   sceRtcGetCurrentTick(&currentTick);
   uint32_t diff = currentTick - lastTick;
   if(diff > 1000000)
   {
      fps = (float)frames * 1000000.0 / diff;
      lastTick = currentTick;
      frames = 0;
   }

   pspDebugScreenSetXY(0,0);
   pspDebugScreenPrintf("%f", fps);
#endif

   psp->draw_buffer = FROM_GU_POINTER(sceGuSwapBuffers());
   g_extern.frame_count++;


   RARCH_PERFORMANCE_INIT(psp_frame_run);
   RARCH_PERFORMANCE_START(psp_frame_run);

   if (psp->should_resize)
      psp_update_viewport(psp);

   psp_set_tex_coords(psp->frame_coords, width, height);

   sceGuStart(GU_DIRECT, psp->main_dList);

   sceGuTexFilter(psp->tex_filter, psp->tex_filter);
   sceGuClear(GU_COLOR_BUFFER_BIT);

   /* frame in VRAM ? texture/palette was 
    * set in core so draw directly */
   if (psp->hw_render) 
      sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF | GU_VERTEX_32BITF | 
            GU_TRANSFORM_2D, PSP_FRAME_VERTEX_COUNT, NULL,
            (void*)(psp->frame_coords));
   else
   {
      if (frame)
      {
         sceKernelDcacheWritebackRange(frame,pitch * height);
         sceGuCopyImage(GU_PSM_5650, ((u32)frame & 0xF) >> psp->bpp_log2,
               0, width, height, pitch >> psp->bpp_log2,
               (void*)((u32)frame & ~0xF), 0, 0, width, psp->texture);
      }
      sceGuTexImage(0, next_pow2(width), next_pow2(height), width, psp->texture);
      sceGuCallList(psp->frame_dList);
   }

   sceGuFinish();

   RARCH_PERFORMANCE_STOP(psp_frame_run);

   if(psp->menu.active)
   {
      sceGuSendList(GU_TAIL, psp->menu.dList, &(psp->menu.context_storage));
      sceGuSync(0, 0);
   }

   return true;
}
예제 #12
0
static int draw_query_panel(SearchPanel* prPanel) {
    SearchPanelConfig* prPcfg = NULL;
    SearchEngine* prEngine = NULL;
    SearchQuery* prQuery = NULL;
    AppletConfig* prApCfg = NULL;
    ColorConfig* prColor = NULL;
    ColorConfig* prCursor = NULL;
    int x = 0;
    int y = 0;
    char *sMode = "None";
    char *sSize = "None";
    char *fs = "0x%08X";
    int row = 0;

    if (prPanel == NULL) {
        return SEARCHPANEL_MEMORY;
    }
    prPcfg = &prPanel->config;
    prEngine = prPanel->prEngine;
    prQuery = &prEngine->rQuery;
    prApCfg = prPanel->prApCfg;
    ESearchMode rMode = prQuery->searchMode;
    ESearchSize rSize = prQuery->searchSize;
    x = prPcfg->top.x;
    y = prPcfg->top.y + 2;
    row = prPanel->cursor.y;
    if (prApCfg != NULL) {
        prColor = appletconfig_get_panelcolor(prApCfg);
        prCursor = appletconfig_get_cursorcolor(prApCfg);
    } else {
        prColor = &prPcfg->color;
        prCursor = &prPcfg->cursor;
    }
    pspDebugScreenSetBackColor(prColor->background);
    pspDebugScreenSetTextColor(prColor->text);
    pspDebugScreenSetXY(x, y);
    pspDebugScreenKprintf("%-10s", "Mode:");
    switch (rMode) {
        case ESM_Immediate:
            sMode = "Immediate Value";
            break;
        case ESM_Text:
            sMode = "Text";
            break;
        case ESM_Byte:
            sMode = "Exact Value";
            break;
    }
    if (row == 0) {
        pspDebugScreenSetBackColor(prCursor->background);
        pspDebugScreenSetTextColor(prCursor->text);
    }
    pspDebugScreenKprintf("%-50s", sMode);
    y++;

    pspDebugScreenSetBackColor(prColor->background);
    pspDebugScreenSetTextColor(prColor->text);
    pspDebugScreenSetXY(x, y);
    pspDebugScreenKprintf("%-10s", "Size:");
    switch (rSize) {
        case ESZ_Byte:
            sSize = "Byte (8-bits)";
            break;
        case ESZ_Dword:
            sSize = "Word (32-bits or 4 bytes)";
            break;
        case ESZ_Word:
            sSize = "Half-Word (16-bits or 2 bytes)";
            break;
    }
    if (row == 1) {
        pspDebugScreenSetBackColor(prCursor->background);
        pspDebugScreenSetTextColor(prCursor->text);
    }
    pspDebugScreenKprintf("%-50s", sSize);
    y++;

    /* Search Range Row */
    pspDebugScreenSetBackColor(prColor->background);
    pspDebugScreenSetTextColor(prColor->text);
    pspDebugScreenSetXY(x, y);
    pspDebugScreenPuts("Range:    Start ");
    DwordColumn *prStart = &prPanel->rStartAddr;
    DwordColumn *prEnd = &prPanel->rEndAddr;
    colorconfig_setcolor(&prStart->color, prColor->background, prColor->text);
    colorconfig_setcolor(&prEnd->color, prColor->background, prColor->text);
    if (row == 2) {
        pspDebugScreenSetBackColor(prCursor->background);
        pspDebugScreenSetTextColor(prCursor->text);
        if (prPanel->cursor.x == 0) {
            colorconfig_setcolor(&prStart->color, prCursor->background,
                    prCursor->text);
        } else {
            colorconfig_setcolor(&prEnd->color, prCursor->background,
                    prCursor->text);
        }
    }
    if (searchpanel_is_editing(prPanel) == 0) {
        dwordcolumn_setvalue(prStart, prQuery->startAddr & 0xBFFFFFFF);
        dwordcolumn_setvalue(prEnd, prQuery->endAddr & 0xBFFFFFFF);
    }
    dwordcolumn_redraw(prStart);
    pspDebugScreenSetBackColor(prColor->background);
    pspDebugScreenSetTextColor(prColor->text);
    pspDebugScreenPuts(" End ");
    dwordcolumn_redraw(prEnd);
    y++;

    pspDebugScreenSetBackColor(prColor->background);
    pspDebugScreenSetTextColor(prColor->text);
    pspDebugScreenSetXY(x, y);
    pspDebugScreenKprintf("%-10s", "Query:");
    DwordColumn *prCol = &prPanel->rQueryCol;
    prCol->color.background = prColor->background;
    prCol->color.text = prColor->text;
    if (row == 3) {
        pspDebugScreenSetBackColor(prCursor->background);
        pspDebugScreenSetTextColor(prCursor->text);
        prCol->color.background = prCursor->background;
        prCol->color.text = prCursor->text;
    }
    if (rMode == ESM_Text) {
        pspDebugScreenKprintf("%-50s", prQuery->text);
    } else {
        if (searchpanel_is_editing(prPanel) == 1) {
            dwordcolumn_redraw(prCol);
        } else {
            switch (rSize) {
                case ESZ_Byte:
                    fs = "      0x%02X";
                    break;
                case ESZ_Dword:
                    fs = "0x%08X";
                    break;
                case ESZ_Word:
                    fs = "    0x%04X";
                    break;
            }
            pspDebugScreenKprintf(fs, prQuery->value);
        }
    }
    
    return SEARCHPANEL_SUCCESS;
}
예제 #13
0
static bool psp_frame(void *data, const void *frame,
                      unsigned width, unsigned height, unsigned pitch, const char *msg)
{
    static char fps_txt[128], fps_text_buf[128];
    psp1_video_t *psp = (psp1_video_t*)data;

#ifdef DISPLAY_FPS
    static uint64_t currentTick,lastTick;
    static float fps=0.0;
    static int frames;
#endif

    if (!width || !height)
        return false;

    sceGuSync(0, 0);

    pspDebugScreenSetBase(psp->draw_buffer);

    pspDebugScreenSetXY(0,0);

    if(g_settings.fps_show)
    {
        gfx_get_fps(fps_txt, sizeof(fps_txt), fps_text_buf, sizeof(fps_text_buf));
        pspDebugScreenSetXY(68 - strlen(fps_text_buf) - 1,0);
        pspDebugScreenPuts(fps_text_buf);
        pspDebugScreenSetXY(0,1);
    }
    else
        gfx_get_fps(fps_txt, sizeof(fps_txt), NULL, 0);

    if (msg)
        pspDebugScreenPuts(msg);

    if (psp->vsync)
        sceDisplayWaitVblankStart();



#ifdef DISPLAY_FPS
    frames++;
    sceRtcGetCurrentTick(&currentTick);
    uint32_t diff = currentTick - lastTick;
    if(diff > 1000000)
    {
        fps = (float)frames * 1000000.0 / diff;
        lastTick = currentTick;
        frames = 0;
    }

    pspDebugScreenSetXY(0,0);
    pspDebugScreenPrintf("%f", fps);
#endif

    psp->draw_buffer = FROM_GU_POINTER(sceGuSwapBuffers());
    g_extern.frame_count++;

    psp->frame_coords->v0.x = (SCEGU_SCR_WIDTH - width * SCEGU_SCR_HEIGHT / height) / 2;
//   psp->frame_coords->v0.y = 0;
//   psp->frame_coords->v0.u = 0;
//   psp->frame_coords->v0.v = 0;

    psp->frame_coords->v1.x = (SCEGU_SCR_WIDTH + width * SCEGU_SCR_HEIGHT / height) / 2;
//   psp->frame_coords->v1.y = SCEGU_SCR_HEIGHT;
    psp->frame_coords->v1.u = width;
    psp->frame_coords->v1.v = height;

    sceGuStart(GU_DIRECT, psp->main_dList);

    if ((uint32_t)frame&0x04000000) // frame in VRAM ? texture/palette was set in core so draw directly
    {
        sceGuClear(GU_COLOR_BUFFER_BIT);
        sceGuDrawArray(GU_SPRITES, GU_TEXTURE_16BIT | GU_COLOR_4444 | GU_VERTEX_16BIT | GU_TRANSFORM_2D, 2, NULL, (void*)(psp->frame_coords));
    }
    else
    {
        if (frame!=NULL)
        {
            sceKernelDcacheWritebackRange(frame,pitch * height);
            sceGuCopyImage(GU_PSM_5650, ((u32)frame & 0xF) >> psp->bpp_log2, 0, width, height, pitch >> psp->bpp_log2, (void*)((u32)frame & ~0xF), 0, 0, width, psp->texture);
        }

        sceGuClear(GU_COLOR_BUFFER_BIT);
        sceGuTexImage(0, next_pow2(width), next_pow2(height), width, psp->texture);
        sceGuCallList(psp->frame_dList);
    }
예제 #14
0
LoadingWindow_PSP::~LoadingWindow_PSP()
{
	pspDebugScreenSetXY( 0, 0 );
	pspDebugScreenSetTextColor( 0xFF000000 );
	pspDebugScreenPuts( text );
}