# HG changeset patch # User Michael Pavone # Date 1468821953 25200 # Node ID 5239f09bccebe85b9092d2ae65a4bc72ac1a87d1 # Parent fc29a122f8175effa7571ea0feb16bd4310db1a2# Parent 4db1a2e5d8e63c954af89798bace01e5a92fc4a0 Merge diff -r fc29a122f817 -r 5239f09bcceb arena.c --- a/arena.c Thu Jun 30 09:42:17 2016 -0700 +++ b/arena.c Sun Jul 17 23:05:53 2016 -0700 @@ -17,6 +17,8 @@ size_t free_storage; }; +#define DEFAULT_STORAGE_SIZE 8 + static arena *current_arena; arena *get_current_arena() @@ -45,7 +47,11 @@ { arena *cur = get_current_arena(); if (cur->used_count == cur->used_storage) { - cur->used_storage *= 2; + if (cur->used_storage) { + cur->used_storage *= 2; + } else { + cur->used_storage = DEFAULT_STORAGE_SIZE; + } cur->used_blocks = realloc(cur->used_blocks, cur->used_storage * sizeof(void *)); } cur->used_blocks[cur->used_count++] = block; diff -r fc29a122f817 -r 5239f09bcceb render_sdl.c --- a/render_sdl.c Thu Jun 30 09:42:17 2016 -0700 +++ b/render_sdl.c Sun Jul 17 23:05:53 2016 -0700 @@ -596,25 +596,40 @@ [SDL_SCANCODE_SPACE] = 0x29, [SDL_SCANCODE_TAB] = 0x0D, [SDL_SCANCODE_BACKSPACE] = 0x66, + [SDL_SCANCODE_MINUS] = 0x4E, + [SDL_SCANCODE_EQUALS] = 0x55, + [SDL_SCANCODE_LEFTBRACKET] = 0x54, + [SDL_SCANCODE_RIGHTBRACKET] = 0x5B, + [SDL_SCANCODE_BACKSLASH] = 0x5D, + [SDL_SCANCODE_SEMICOLON] = 0x4C, + [SDL_SCANCODE_APOSTROPHE] = 0x52, + [SDL_SCANCODE_GRAVE] = 0x0E, + [SDL_SCANCODE_COMMA] = 0x41, + [SDL_SCANCODE_PERIOD] = 0x49, + [SDL_SCANCODE_SLASH] = 0x4A, + [SDL_SCANCODE_CAPSLOCK] = 0x58, [SDL_SCANCODE_F1] = 0x05, - [SDL_SCANCODE_F2] = 0x06, - [SDL_SCANCODE_F3] = 0x04, - [SDL_SCANCODE_F4] = 0x0C, - [SDL_SCANCODE_F5] = 0x03, - [SDL_SCANCODE_F6] = 0x0B, - [SDL_SCANCODE_F7] = 0x83, - [SDL_SCANCODE_F8] = 0x0A, - [SDL_SCANCODE_F9] = 0x01, - [SDL_SCANCODE_F10] = 0x09, - [SDL_SCANCODE_F11] = 0x78, - [SDL_SCANCODE_F12] = 0x07, + [SDL_SCANCODE_F2] = 0x06, + [SDL_SCANCODE_F3] = 0x04, + [SDL_SCANCODE_F4] = 0x0C, + [SDL_SCANCODE_F5] = 0x03, + [SDL_SCANCODE_F6] = 0x0B, + [SDL_SCANCODE_F7] = 0x83, + [SDL_SCANCODE_F8] = 0x0A, + [SDL_SCANCODE_F9] = 0x01, + [SDL_SCANCODE_F10] = 0x09, + [SDL_SCANCODE_F11] = 0x78, + [SDL_SCANCODE_F12] = 0x07, [SDL_SCANCODE_LCTRL] = 0x14, - [SDL_SCANCODE_LSHIFT] = 0x12, - [SDL_SCANCODE_LALT] = 0x11, + [SDL_SCANCODE_LSHIFT] = 0x12, + [SDL_SCANCODE_LALT] = 0x11, + [SDL_SCANCODE_RCTRL] = 0x18, [SDL_SCANCODE_RSHIFT] = 0x59, + [SDL_SCANCODE_RALT] = 0x17, [SDL_SCANCODE_INSERT] = 0x81, [SDL_SCANCODE_PAUSE] = 0x82, [SDL_SCANCODE_PRINTSCREEN] = 0x84, + [SDL_SCANCODE_SCROLLLOCK] = 0x7E, [SDL_SCANCODE_DELETE] = 0x85, [SDL_SCANCODE_LEFT] = 0x86, [SDL_SCANCODE_HOME] = 0x87, @@ -623,7 +638,24 @@ [SDL_SCANCODE_DOWN] = 0x8A, [SDL_SCANCODE_PAGEUP] = 0x8B, [SDL_SCANCODE_PAGEDOWN] = 0x8C, - [SDL_SCANCODE_RIGHT] = 0x8D + [SDL_SCANCODE_RIGHT] = 0x8D, + [SDL_SCANCODE_NUMLOCKCLEAR] = 0x77, + [SDL_SCANCODE_KP_DIVIDE] = 0x80, + [SDL_SCANCODE_KP_MULTIPLY] = 0x7C, + [SDL_SCANCODE_KP_MINUS] = 0x7B, + [SDL_SCANCODE_KP_PLUS] = 0x79, + [SDL_SCANCODE_KP_ENTER] = 0x19, + [SDL_SCANCODE_KP_1] = 0x69, + [SDL_SCANCODE_KP_2] = 0x72, + [SDL_SCANCODE_KP_3] = 0x7A, + [SDL_SCANCODE_KP_4] = 0x6B, + [SDL_SCANCODE_KP_5] = 0x73, + [SDL_SCANCODE_KP_6] = 0x74, + [SDL_SCANCODE_KP_7] = 0x6C, + [SDL_SCANCODE_KP_8] = 0x75, + [SDL_SCANCODE_KP_9] = 0x7D, + [SDL_SCANCODE_KP_0] = 0x70, + [SDL_SCANCODE_KP_PERIOD] = 0x71, }; int32_t handle_event(SDL_Event *event) diff -r fc29a122f817 -r 5239f09bcceb romdb.c --- a/romdb.c Thu Jun 30 09:42:17 2016 -0700 +++ b/romdb.c Sun Jul 17 23:05:53 2016 -0700 @@ -418,7 +418,7 @@ } } else { last++; - char *ret = malloc(last - (rom + TITLE_START) + 1); + char *ret = malloc(last - src + 1); uint8_t *dst; uint8_t last_was_space = 1; for (dst = ret; src < last; src++) diff -r fc29a122f817 -r 5239f09bcceb vdp.c --- a/vdp.c Thu Jun 30 09:42:17 2016 -0700 +++ b/vdp.c Sun Jul 17 23:05:53 2016 -0700 @@ -826,20 +826,18 @@ void render_map(uint16_t col, uint8_t * tmp_buf, uint8_t offset, vdp_context * context) { uint16_t address; - uint8_t shift, add; + uint16_t vflip_base; if (context->double_res) { address = ((col & 0x3FF) << 6); - shift = 1; - add = context->framebuf != context->oddbuf ? 1 : 0; + vflip_base = 60; } else { address = ((col & 0x7FF) << 5); - shift = 0; - add = 0; + vflip_base = 28; } if (col & MAP_BIT_V_FLIP) { - address += 28 - 4 * context->v_offset/*((context->v_offset << shift) + add)*/; + address += vflip_base - 4 * context->v_offset; } else { - address += 4 * context->v_offset/*((context->v_offset << shift) + add)*/; + address += 4 * context->v_offset; } uint16_t pal_priority = (col >> 9) & 0x70; int32_t dir;