this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

added blit segment info to the VRAM info command and some cosmetic code changes

nesbox 4bdf83e4 4208ced1

+58 -77
+1
src/console.c
··· 2594 2594 {offsetof(tic_ram, vram.vars.colors), "BORDER"}, 2595 2595 {offsetof(tic_ram, vram.vars.offset), "SCREEN OFFSET"}, 2596 2596 {offsetof(tic_ram, vram.vars.cursor), "MOUSE CURSOR"}, 2597 + {offsetof(tic_ram, vram.blit), "BLIT SEGMENT"}, 2597 2598 {offsetof(tic_ram, vram.reserved), "..."}, 2598 2599 {TIC_VRAM_SIZE, ""}, 2599 2600 };
+7 -7
src/dialog.c
··· 57 57 tic_api_rect(tic, rect.x, rect.y, rect.w, rect.h, tic_color_12); 58 58 } 59 59 60 - s32 size = tic_api_print(tic, label, 0, -TIC_FONT_HEIGHT, 0, true, 1, false); 61 - tic_api_print(tic, label, rect.x + (BtnWidth - size+1)/2, rect.y + (down?3:2), color, true, 1, false); 60 + s32 size = tic_api_print(tic, label, 0, -TIC_FONT_HEIGHT, 0, false, 1, false); 61 + tic_api_print(tic, label, rect.x + (BtnWidth - size+1)/2, rect.y + (down?3:2), color, false, 1, false); 62 62 63 63 if(dlg->focus == id) 64 64 { ··· 162 162 163 163 { 164 164 static const char Label[] = "WARNING!"; 165 - s32 size = tic_api_print(tic, Label, 0, -TIC_FONT_HEIGHT, 0, true, 1, false); 166 - tic_api_print(tic, Label, rect.x + (Width - size)/2, rect.y-(TOOLBAR_SIZE-2), tic_color_15, true, 1, false); 165 + s32 size = tic_api_print(tic, Label, 0, -TIC_FONT_HEIGHT, 0, false, 1, false); 166 + tic_api_print(tic, Label, rect.x + (Width - size)/2, rect.y-(TOOLBAR_SIZE-2), tic_color_15, false, 1, false); 167 167 } 168 168 169 169 { ··· 175 175 { 176 176 for(s32 i = 0; i < dlg->rows; i++) 177 177 { 178 - s32 size = tic_api_print(tic, dlg->text[i], 0, -TIC_FONT_HEIGHT, 0, true, 1, false); 178 + s32 size = tic_api_print(tic, dlg->text[i], 0, -TIC_FONT_HEIGHT, 0, false, 1, false); 179 179 180 180 s32 x = rect.x + (Width - size)/2; 181 181 s32 y = rect.y + (TIC_FONT_HEIGHT+1)*(i+1); 182 - tic_api_print(tic, dlg->text[i], x, y+1, tic_color_0, true, 1, false); 183 - tic_api_print(tic, dlg->text[i], x, y, tic_color_12, true, 1, false); 182 + tic_api_print(tic, dlg->text[i], x, y+1, tic_color_0, false, 1, false); 183 + tic_api_print(tic, dlg->text[i], x, y, tic_color_12, false, 1, false); 184 184 } 185 185 } 186 186
+11 -11
src/menu.c
··· 119 119 120 120 { 121 121 static const char Label[] = "GAME MENU"; 122 - s32 size = tic_api_print(tic, Label, 0, -TIC_FONT_HEIGHT, 0, true, 1, false); 123 - tic_api_print(tic, Label, rect.x + (DIALOG_WIDTH - size)/2, rect.y-(TOOLBAR_SIZE-2), tic_color_15, true, 1, false); 122 + s32 size = tic_api_print(tic, Label, 0, -TIC_FONT_HEIGHT, 0, false, 1, false); 123 + tic_api_print(tic, Label, rect.x + (DIALOG_WIDTH - size)/2, rect.y-(TOOLBAR_SIZE-2), tic_color_15, false, 1, false); 124 124 } 125 125 126 126 { ··· 158 158 { 159 159 char buf[] = "#1"; 160 160 sprintf(buf, "#%i", id+1); 161 - tic_api_print(tic, buf, x+2, y, (over ? tic_color_12 : tic_color_13), true, 1, false); 161 + tic_api_print(tic, buf, x+2, y, (over ? tic_color_12 : tic_color_13), false, 1, false); 162 162 } 163 163 } 164 164 ··· 175 175 { 176 176 char buf[] = "#1"; 177 177 sprintf(buf, "#%i", id+1); 178 - tic_api_print(tic, buf, x+2, y, tic_color_15, true, 1, false); 178 + tic_api_print(tic, buf, x+2, y, tic_color_15, false, 1, false); 179 179 } 180 180 } 181 181 ··· 222 222 if(strlen(label) > MaxChars) 223 223 label[MaxChars] = '\0'; 224 224 225 - tic_api_print(tic, label, rect.x+10, rect.y+2, (over ? tic_color_14 : tic_color_15), true, 1, false); 225 + tic_api_print(tic, label, rect.x+10, rect.y+2, (over ? tic_color_14 : tic_color_15), false, 1, false); 226 226 } 227 227 } 228 228 ··· 284 284 285 285 if(down) 286 286 { 287 - tic_api_print(tic, Label, rect.x, rect.y+1, tic_color_13, true, 1, false); 287 + tic_api_print(tic, Label, rect.x, rect.y+1, tic_color_13, false, 1, false); 288 288 } 289 289 else 290 290 { 291 - tic_api_print(tic, Label, rect.x, rect.y+1, tic_color_0, true, 1, false); 292 - tic_api_print(tic, Label, rect.x, rect.y, (over ? tic_color_13 : tic_color_12), true, 1, false); 291 + tic_api_print(tic, Label, rect.x, rect.y+1, tic_color_0, false, 1, false); 292 + tic_api_print(tic, Label, rect.x, rect.y, (over ? tic_color_13 : tic_color_12), false, 1, false); 293 293 } 294 294 295 295 { ··· 353 353 354 354 if(down) 355 355 { 356 - tic_api_print(tic, Rows[i], label.x, label.y+1, tic_color_13, true, 1, false); 356 + tic_api_print(tic, Rows[i], label.x, label.y+1, tic_color_13, false, 1, false); 357 357 } 358 358 else 359 359 { 360 - tic_api_print(tic, Rows[i], label.x, label.y+1, tic_color_0, true, 1, false); 361 - tic_api_print(tic, Rows[i], label.x, label.y, (over ? tic_color_13 : tic_color_12), true, 1, false); 360 + tic_api_print(tic, Rows[i], label.x, label.y+1, tic_color_0, false, 1, false); 361 + tic_api_print(tic, Rows[i], label.x, label.y, (over ? tic_color_13 : tic_color_12), false, 1, false); 362 362 } 363 363 364 364 if(i == menu->main.focus)
-24
src/sprite.c
··· 72 72 clearCanvasSelection(sprite); 73 73 } 74 74 75 - static void setIndex(Sprite* sprite, u16 index) 76 - { 77 - 78 - u16 nb_pages = sprite->nbPages; 79 - u16 sheet_w = (nb_pages*SHEET_COLS); 80 - u16 sheet_y = index/sheet_w, sheet_x = index%sheet_w; 81 - 82 - sprite->bank = (sheet_y/ SHEET_COLS) & 1; 83 - sprite->page = ((sheet_x/SHEET_COLS) & (nb_pages - 1)) ; 84 - sprite->x = sheet_x % SHEET_COLS; 85 - sprite->y = sheet_y % SHEET_COLS; 86 - 87 - updateIndex(sprite); 88 - } 89 - 90 75 static void leftViewport(Sprite* sprite) 91 76 { 92 77 if (sprite->page > 0) sprite->page--; ··· 106 91 sprite->page = page; 107 92 updateIndex(sprite); 108 93 initTileSheet(sprite); 109 - } 110 - 111 - static tic_point viewportToSheet(Sprite* sprite, u16 x, u16 y) 112 - { 113 - tic_point sheet_point = { 114 - sprite->page*TIC_SPRITESHEET_SIZE + x, 115 - sprite->bank*TIC_SPRITESHEET_SIZE + y, 116 - }; 117 - return sheet_point; 118 94 } 119 95 120 96 static u8 getSheetPixel(Sprite* sprite, s32 x, s32 y)
src/system/font.inl src/font.inl
+6 -4
src/tic.c
··· 407 407 else 408 408 { 409 409 s32 step = TIC_SPRITESIZE * scale; 410 - s32 cols = sheet.segment.sheet_width; 410 + s32 cols = sheet.segment->sheet_width; 411 411 412 412 const tic_flip vert_horz_flip = tic_horz_flip | tic_vert_flip; 413 413 ··· 516 516 return width; 517 517 } 518 518 519 - s32 drawText(tic_machine* machine, tic_tilesheet* font_face, const char* text, s32 x, s32 y, s32 width, s32 height, bool fixed, u8* mapping, s32 scale, bool alt) 519 + static s32 drawText(tic_machine* machine, tic_tilesheet* font_face, const char* text, s32 x, s32 y, s32 width, s32 height, bool fixed, u8* mapping, s32 scale, bool alt) 520 520 { 521 521 s32 pos = x; 522 522 s32 MAX = x; ··· 1637 1637 1638 1638 static void cart2ram(tic_mem* memory) 1639 1639 { 1640 - static const u8 Font[] = { 1641 - #include "system/font.inl" 1640 + static const u8 Font[] = 1641 + { 1642 + #include "font.inl" 1642 1643 }; 1644 + 1643 1645 memcpy(memory->ram.font.data, Font, sizeof Font); 1644 1646 1645 1647 tic_api_sync(memory, 0, 0, false);
+11 -11
src/tilesheet.c
··· 56 56 57 57 tic_tilesheet getTileSheet(u8 segment, u8* ptr) 58 58 { 59 - return (tic_tilesheet){segments[segment], ptr}; 59 + return (tic_tilesheet){&segments[segment], ptr}; 60 60 } 61 61 62 62 tic_tileptr getTile(const tic_tilesheet* sheet, s32 index, bool local) 63 63 { 64 64 enum {Cols=16, Size=8}; 65 - tic_blit_segment segment = sheet->segment; 65 + const tic_blit_segment* segment = sheet->segment; 66 66 67 67 s32 bank, page, iy, ix; 68 68 if (local) { 69 69 index = index & 255; 70 - bank = segment.bank_orig; 71 - page = segment.page_orig; 70 + bank = segment->bank_orig; 71 + page = segment->page_orig; 72 72 div_t ixy = div(index, Cols); 73 73 iy = ixy.quot; 74 74 ix = ixy.rem; 75 75 } 76 76 else { 77 77 // reindex 78 - div_t ia = div(index, segment.bank_size); // bank, bank_index 79 - div_t ib = div(ia.rem, segment.sheet_width); // yi, bank_xi 78 + div_t ia = div(index, segment->bank_size); // bank, bank_index 79 + div_t ib = div(ia.rem, segment->sheet_width); // yi, bank_xi 80 80 div_t ic = div(ib.rem, Cols); // page, xi 81 - bank = (ia.quot + segment.bank_orig) % 2; 82 - page = (ic.quot + segment.page_orig) % segment.nb_pages; 81 + bank = (ia.quot + segment->bank_orig) % 2; 82 + page = (ic.quot + segment->page_orig) % segment->nb_pages; 83 83 iy = ib.quot % Cols; 84 84 ix = ic.rem; 85 85 } 86 86 87 - div_t xdiv = div(ix, segment.nb_pages); // xbuffer, xoffset 88 - u32 ptr_offset = ( bank * Cols + iy ) * Cols + page * Cols / segment.nb_pages + xdiv.quot; 89 - u8* ptr = sheet->ptr + segment.ptr_size * ptr_offset; 87 + div_t xdiv = div(ix, segment->nb_pages); // xbuffer, xoffset 88 + u32 ptr_offset = ( bank * Cols + iy ) * Cols + page * Cols / segment->nb_pages + xdiv.quot; 89 + u8* ptr = sheet->ptr + segment->ptr_size * ptr_offset; 90 90 u32 offset = (xdiv.rem * Size); 91 91 92 92 return (tic_tileptr){segment, offset, ptr};
+12 -12
src/tilesheet.h
··· 41 41 42 42 typedef struct 43 43 { 44 - tic_blit_segment segment; 44 + const tic_blit_segment* segment; 45 45 u8* ptr; 46 46 } tic_tilesheet; 47 47 48 48 typedef struct 49 49 { 50 - tic_blit_segment segment; 50 + const tic_blit_segment* segment; 51 51 u32 offset; 52 52 u8* ptr; 53 53 } tic_tileptr; ··· 58 58 inline u8 getTileSheetPixel(const tic_tilesheet* sheet, s32 x, s32 y) 59 59 { 60 60 // tile coord 61 - u16 tile_index = ((y >> 3) << 4 ) + (x / sheet->segment.tile_width); 61 + u16 tile_index = ((y >> 3) << 4 ) + (x / sheet->segment->tile_width); 62 62 // coord in tile 63 - u32 pix_addr = ((x & (sheet->segment.tile_width - 1)) + ((y & 7) * sheet->segment.tile_width)) ; 64 - return sheet->segment.peek(sheet->ptr+tile_index * sheet->segment.ptr_size, pix_addr); 63 + u32 pix_addr = ((x & (sheet->segment->tile_width - 1)) + ((y & 7) * sheet->segment->tile_width)) ; 64 + return sheet->segment->peek(sheet->ptr+tile_index * sheet->segment->ptr_size, pix_addr); 65 65 } 66 66 67 67 inline void setTileSheetPixel(const tic_tilesheet* sheet, s32 x, s32 y, u8 value) 68 68 { 69 69 // tile coord 70 - u16 tile_index = ((y >> 3) << 4 ) + (x / sheet->segment.tile_width); 70 + u16 tile_index = ((y >> 3) << 4 ) + (x / sheet->segment->tile_width); 71 71 // coord in tile 72 - u32 pix_addr = ((x & (sheet->segment.tile_width - 1)) + ((y & 7) * sheet->segment.tile_width)) ; 73 - sheet->segment.poke(sheet->ptr + tile_index * sheet->segment.ptr_size, pix_addr, value); 72 + u32 pix_addr = ((x & (sheet->segment->tile_width - 1)) + ((y & 7) * sheet->segment->tile_width)) ; 73 + sheet->segment->poke(sheet->ptr + tile_index * sheet->segment->ptr_size, pix_addr, value); 74 74 } 75 75 76 76 inline u8 getTilePixel(const tic_tileptr* tile, s32 x, s32 y) 77 77 { 78 - u32 addr = tile->offset + x + (y * tile->segment.tile_width); 79 - return tile->segment.peek(tile->ptr, addr); 78 + u32 addr = tile->offset + x + (y * tile->segment->tile_width); 79 + return tile->segment->peek(tile->ptr, addr); 80 80 } 81 81 82 82 inline void setTilePixel(const tic_tileptr* tile, s32 x, s32 y, u8 value) 83 83 { 84 - u32 addr = tile->offset + x + (y * tile->segment.tile_width); 85 - tile->segment.poke(tile->ptr, addr, value); 84 + u32 addr = tile->offset + x + (y * tile->segment->tile_width); 85 + tile->segment->poke(tile->ptr, addr, value); 86 86 }
+10 -8
src/tools.h
··· 30 30 return speed > 0 ? ticks * (1 + speed) : ticks / (1 - speed); 31 31 } 32 32 33 - #define POKE_N(P,I,V,A,B,C,D) do { \ 34 - u8* val = (u8*)(P) + ((I) >> (A)); \ 35 - u8 offset = ((I) & (B)) << (C); \ 36 - *val &= ~((D) << offset); \ 37 - *val |= ((V) & (D)) << offset; \ 33 + #define POKE_N(P,I,V,A,B,C,D) do \ 34 + { \ 35 + u8* val = (u8*)(P) + ((I) >> (A)); \ 36 + u8 offset = ((I) & (B)) << (C); \ 37 + *val &= ~((D) << offset); \ 38 + *val |= ((V) & (D)) << offset; \ 38 39 } while(0) 39 40 40 41 #define PEEK_N(P,I,A,B,C,D) ( ( ((u8*)(P))[((I) >> (A))] >> ( ((I) & (B)) << (C) ) ) & (D) ) 41 42 42 43 inline void tic_tool_poke4(void* addr, u32 index, u8 value) 43 44 { 44 - POKE_N(addr, index, value, 1,1,2,15); 45 + POKE_N(addr, index, value, 1,1,2,15); 45 46 } 46 47 47 48 inline u8 tic_tool_peek4(const void* addr, u32 index) ··· 51 52 52 53 inline void tic_tool_poke2(void* addr, u32 index, u8 value) 53 54 { 54 - POKE_N(addr, index, value, 2,3,1,3); 55 + POKE_N(addr, index, value, 2,3,1,3); 55 56 } 56 57 57 58 inline u8 tic_tool_peek2(const void* addr, u32 index) ··· 61 62 62 63 inline void tic_tool_poke1(void* addr, u32 index, u8 value) 63 64 { 64 - POKE_N(addr, index, value, 3,7,0,1); 65 + POKE_N(addr, index, value, 3,7,0,1); 65 66 } 66 67 67 68 inline u8 tic_tool_peek1(const void* addr, u32 index) 68 69 { 69 70 return PEEK_N(addr, index, 3,7,0,1); 70 71 } 72 + 71 73 #undef PEEK_N 72 74 #undef POKE_N 73 75