Created
February 20, 2019 10:49
-
-
Save autch/c87c97953ed9c252a87ee1cc40ffeace to your computer and use it in GitHub Desktop.
P/EMU/SDL を GameShell で動くようにするパッチ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/app.h b/app.h | |
| index 423adb9..d1ea127 100644 | |
| --- a/app.h | |
| +++ b/app.h | |
| @@ -77,10 +77,11 @@ struct tagPIEMU_CONTEXT; | |
| #define KEY_DOWN SDL_SCANCODE_DOWN | |
| #define KEY_LEFT SDL_SCANCODE_LEFT | |
| #define KEY_RIGHT SDL_SCANCODE_RIGHT | |
| -#define KEY_A SDL_SCANCODE_Z | |
| -#define KEY_B SDL_SCANCODE_X | |
| -#define KEY_START SDL_SCANCODE_A | |
| -#define KEY_SELECT SDL_SCANCODE_S | |
| +#define KEY_A SDL_SCANCODE_K | |
| +#define KEY_B SDL_SCANCODE_J | |
| +#define KEY_START SDL_SCANCODE_RETURN | |
| +#define KEY_SELECT SDL_SCANCODE_SPACE | |
| +#define KEY_QUIT SDL_SCANCODE_ESCAPE | |
| #ifdef PSP | |
| #define JOY_CIRCLE 1 // as A | |
| diff --git a/main.c b/main.c | |
| index a045d49..7870d7e 100644 | |
| --- a/main.c | |
| +++ b/main.c | |
| @@ -75,11 +75,11 @@ unsigned char fsbuff[DISP_Y * 5][DISP_X * 5]; /* フルスクリーン展開用 | |
| void ui_init(PIEMU_CONTEXT *context) | |
| { | |
| - context->window = SDL_CreateWindow("P/EMU/SDL", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, | |
| - 128 * 4, 88 * 4, 0); | |
| + context->window = SDL_CreateWindow("P/EMU/SDL", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, | |
| + 128 * 2, 88 * 2, SDL_WINDOW_FULLSCREEN); | |
| // 0, 0, SDL_WINDOW_FULLSCREEN_DESKTOP); | |
| context->renderer = SDL_CreateRenderer(context->window, -1, 0); | |
| -// SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); // make the scaled rendering look smoother. | |
| + SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); // make the scaled rendering look smoother. | |
| SDL_RenderSetLogicalSize(context->renderer, 128, 88); | |
| context->texture = SDL_CreateTexture(context->renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 128, | |
| 88); | |
| @@ -139,6 +139,10 @@ int main(int argc, char *argv[]) | |
| switch (event.type) { | |
| case SDL_QUIT: | |
| goto L_EXIT; | |
| + case SDL_KEYDOWN: | |
| + if(event.key.keysym.scancode == KEY_QUIT) | |
| + goto L_EXIT; | |
| + break; | |
| #ifdef PSP | |
| case SDL_JOYBUTTONDOWN: | |
| { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment