Be consistent with hex casing
This commit is contained in:
parent
efe31cefc9
commit
a4209b47d0
@ -1795,7 +1795,7 @@ static unsigned *multiplication_table_for_frequency(unsigned frequency)
|
||||
uint8_t *vram = GB_get_direct_access(&gb, GB_DIRECT_ACCESS_VRAM, NULL, NULL);
|
||||
|
||||
if (map_type == GB_MAP_9C00 || (map_type == GB_MAP_AUTO && lcdc & 0x08)) {
|
||||
map_base = 0x1c00;
|
||||
map_base = 0x1C00;
|
||||
}
|
||||
|
||||
if (tileset_type == GB_TILESET_AUTO) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
static inline double scale_channel(uint8_t x)
|
||||
{
|
||||
x &= 0x1f;
|
||||
x &= 0x1F;
|
||||
return x / 31.0;
|
||||
}
|
||||
|
||||
|
16
Core/apu.c
16
Core/apu.c
@ -87,17 +87,17 @@ static void update_sample(GB_gameboy_t *gb, unsigned index, int8_t value, unsign
|
||||
uint8_t bias = agb_bias_for_channel(gb, index);
|
||||
|
||||
if (gb->io_registers[GB_IO_NR51] & (1 << index)) {
|
||||
output.right = (0xf - value * 2 + bias) * right_volume;
|
||||
output.right = (0xF - value * 2 + bias) * right_volume;
|
||||
}
|
||||
else {
|
||||
output.right = 0xf * right_volume;
|
||||
output.right = 0xF * right_volume;
|
||||
}
|
||||
|
||||
if (gb->io_registers[GB_IO_NR51] & (0x10 << index)) {
|
||||
output.left = (0xf - value * 2 + bias) * left_volume;
|
||||
output.left = (0xF - value * 2 + bias) * left_volume;
|
||||
}
|
||||
else {
|
||||
output.left = 0xf * left_volume;
|
||||
output.left = 0xF * left_volume;
|
||||
}
|
||||
|
||||
if (*(uint32_t *)&(gb->apu_output.current_sample[index]) != *(uint32_t *)&output) {
|
||||
@ -127,7 +127,7 @@ static void update_sample(GB_gameboy_t *gb, unsigned index, int8_t value, unsign
|
||||
if (gb->io_registers[GB_IO_NR51] & (0x10 << index)) {
|
||||
left_volume = ((gb->io_registers[GB_IO_NR50] >> 4) & 7) + 1;
|
||||
}
|
||||
GB_sample_t output = {(0xf - value * 2) * left_volume, (0xf - value * 2) * right_volume};
|
||||
GB_sample_t output = {(0xF - value * 2) * left_volume, (0xF - value * 2) * right_volume};
|
||||
if (*(uint32_t *)&(gb->apu_output.current_sample[index]) != *(uint32_t *)&output) {
|
||||
refresh_channel(gb, index, cycles_offset);
|
||||
gb->apu_output.current_sample[index] = output;
|
||||
@ -1058,9 +1058,9 @@ void GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value)
|
||||
case GB_IO_NR11:
|
||||
case GB_IO_NR21: {
|
||||
unsigned index = reg == GB_IO_NR21? GB_SQUARE_2: GB_SQUARE_1;
|
||||
gb->apu.square_channels[index].pulse_length = (0x40 - (value & 0x3f));
|
||||
gb->apu.square_channels[index].pulse_length = (0x40 - (value & 0x3F));
|
||||
if (!gb->apu.global_enable) {
|
||||
value &= 0x3f;
|
||||
value &= 0x3F;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1322,7 +1322,7 @@ void GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value)
|
||||
/* Noise Channel */
|
||||
|
||||
case GB_IO_NR41: {
|
||||
gb->apu.noise_channel.pulse_length = (0x40 - (value & 0x3f));
|
||||
gb->apu.noise_channel.pulse_length = (0x40 - (value & 0x3F));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1752,7 +1752,7 @@ static bool apu(GB_gameboy_t *gb, char *arguments, char *modifiers, const debugg
|
||||
}
|
||||
|
||||
GB_log(gb, "SO1 (left output): volume %u,", gb->io_registers[GB_IO_NR50] & 0x07);
|
||||
if (gb->io_registers[GB_IO_NR51] & 0x0f) {
|
||||
if (gb->io_registers[GB_IO_NR51] & 0x0F) {
|
||||
for (uint8_t channel = 0, mask = 0x01; channel < GB_N_CHANNELS; channel++, mask <<= 1) {
|
||||
if (gb->io_registers[GB_IO_NR51] & mask) {
|
||||
GB_log(gb, " CH%u", channel + 1);
|
||||
@ -1765,7 +1765,7 @@ static bool apu(GB_gameboy_t *gb, char *arguments, char *modifiers, const debugg
|
||||
GB_log(gb, "%s\n", gb->io_registers[GB_IO_NR50] & 0x80 ? " VIN": "");
|
||||
|
||||
GB_log(gb, "SO2 (right output): volume %u,", gb->io_registers[GB_IO_NR50] & 0x70 >> 4);
|
||||
if (gb->io_registers[GB_IO_NR51] & 0xf0) {
|
||||
if (gb->io_registers[GB_IO_NR51] & 0xF0) {
|
||||
for (uint8_t channel = 0, mask = 0x10; channel < GB_N_CHANNELS; channel++, mask <<= 1) {
|
||||
if (gb->io_registers[GB_IO_NR51] & mask) {
|
||||
GB_log(gb, " CH%u", channel + 1);
|
||||
@ -1833,7 +1833,7 @@ static bool apu(GB_gameboy_t *gb, char *arguments, char *modifiers, const debugg
|
||||
gb->apu.wave_channel.shift);
|
||||
|
||||
GB_log(gb, " Current sample length: %u APU ticks (next in %u ticks)\n",
|
||||
gb->apu.wave_channel.sample_length ^ 0x7ff,
|
||||
gb->apu.wave_channel.sample_length ^ 0x7FF,
|
||||
gb->apu.wave_channel.sample_countdown);
|
||||
|
||||
if (gb->apu.wave_channel.length_enabled) {
|
||||
@ -1901,9 +1901,9 @@ static bool wave(GB_gameboy_t *gb, char *arguments, char *modifiers, const debug
|
||||
break;
|
||||
}
|
||||
}
|
||||
mask = (0xf << (shift_amount - 1)) & 0xf;
|
||||
mask = (0xF << (shift_amount - 1)) & 0xF;
|
||||
|
||||
for (int8_t cur_val = 0xf & mask; cur_val >= 0; cur_val -= shift_amount) {
|
||||
for (int8_t cur_val = 0xF & mask; cur_val >= 0; cur_val -= shift_amount) {
|
||||
for (uint8_t i = 0; i < 32; i++) {
|
||||
uint8_t sample = i & 1?
|
||||
(gb->io_registers[GB_IO_WAV_START + i / 2] & 0xF) :
|
||||
|
@ -165,7 +165,7 @@ void GB_display_vblank(GB_gameboy_t *gb)
|
||||
0x30DA, 0x69AD, 0x2B57, 0x2B5D, 0x632C,
|
||||
0x1050, 0x3C84, 0x0E07, 0x0E18, 0x2964,
|
||||
};
|
||||
unsigned index = gb->rom? gb->rom[0x14e] % 5 : 0;
|
||||
unsigned index = gb->rom? gb->rom[0x14E] % 5 : 0;
|
||||
if (gb->model == GB_MODEL_CGB_0) {
|
||||
index = 1; // CGB 0 was only available in indigo!
|
||||
}
|
||||
@ -331,10 +331,10 @@ uint32_t GB_convert_rgb15(GB_gameboy_t *gb, uint16_t color, bool for_border)
|
||||
uint8_t old_min = MIN(r, MIN(g, b));
|
||||
uint8_t new_min = MIN(new_r, MIN(new_g, new_b));
|
||||
|
||||
if (new_min != 0xff) {
|
||||
new_r = 0xff - (0xff - new_r) * (0xff - old_min) / (0xff - new_min);
|
||||
new_g = 0xff - (0xff - new_g) * (0xff - old_min) / (0xff - new_min);
|
||||
new_b = 0xff - (0xff - new_b) * (0xff - old_min) / (0xff - new_min);
|
||||
if (new_min != 0xFF) {
|
||||
new_r = 0xFF - (0xFF - new_r) * (0xFF - old_min) / (0xFF - new_min);
|
||||
new_g = 0xFF - (0xFF - new_g) * (0xFF - old_min) / (0xFF - new_min);
|
||||
new_b = 0xFF - (0xFF - new_b) * (0xFF - old_min) / (0xFF - new_min);
|
||||
}
|
||||
}
|
||||
r = new_r;
|
||||
@ -471,7 +471,7 @@ static inline uint8_t oam_read(GB_gameboy_t *gb, uint8_t addr)
|
||||
if (unlikely(gb->oam_ppu_blocked)) {
|
||||
return 0xFF;
|
||||
}
|
||||
if (unlikely(gb->dma_current_dest <= 0xa0 && gb->dma_current_dest > 0)) { // TODO: what happens in the last and first M cycles?
|
||||
if (unlikely(gb->dma_current_dest <= 0xA0 && gb->dma_current_dest > 0)) { // TODO: what happens in the last and first M cycles?
|
||||
if (gb->hdma_in_progress) {
|
||||
return GB_read_oam(gb, (gb->hdma_current_src & ~1) | (addr & 1));
|
||||
}
|
||||
@ -705,7 +705,7 @@ static inline uint8_t vram_read(GB_gameboy_t *gb, uint16_t addr)
|
||||
return 0;
|
||||
}
|
||||
// TODO: what if both?
|
||||
else if (unlikely(gb->dma_current_dest <= 0xa0 && gb->dma_current_dest > 0 && (gb->dma_current_src & 0xE000) == 0x8000)) { // TODO: what happens in the last and first M cycles?
|
||||
else if (unlikely(gb->dma_current_dest <= 0xA0 && gb->dma_current_dest > 0 && (gb->dma_current_src & 0xE000) == 0x8000)) { // TODO: what happens in the last and first M cycles?
|
||||
// DMAing from VRAM!
|
||||
/* TODO: AGS has its own, very different pattern, but AGS is not currently a supported model */
|
||||
/* TODO: Research this when researching odd modes */
|
||||
@ -880,7 +880,7 @@ static void advance_fetcher_state_machine(GB_gameboy_t *gb, unsigned *cycles)
|
||||
}
|
||||
if (gb->wx_triggered) {
|
||||
gb->window_tile_x++;
|
||||
gb->window_tile_x &= 0x1f;
|
||||
gb->window_tile_x &= 0x1F;
|
||||
}
|
||||
|
||||
// fallthrough
|
||||
@ -1984,7 +1984,7 @@ void GB_draw_tilemap(GB_gameboy_t *gb, uint32_t *dest, GB_palette_type_t palette
|
||||
}
|
||||
|
||||
if (map_type == GB_MAP_9C00 || (map_type == GB_MAP_AUTO && gb->io_registers[GB_IO_LCDC] & 0x08)) {
|
||||
map = 0x1c00;
|
||||
map = 0x1C00;
|
||||
}
|
||||
|
||||
if (tileset_type == GB_TILESET_AUTO) {
|
||||
|
104
Core/gb.c
104
Core/gb.c
@ -437,12 +437,12 @@ int GB_load_gbs_from_buffer(GB_gameboy_t *gb, const uint8_t *buffer, size_t size
|
||||
if (gb->gbs_header.load_address) {
|
||||
// Generate interrupt handlers
|
||||
for (unsigned i = 0; i <= (has_interrupts? 0x50 : 0x38); i += 8) {
|
||||
gb->rom[i] = 0xc3; // jp $XXXX
|
||||
gb->rom[i] = 0xC3; // jp $XXXX
|
||||
gb->rom[i + 1] = (LE16(gb->gbs_header.load_address) + i);
|
||||
gb->rom[i + 2] = (LE16(gb->gbs_header.load_address) + i) >> 8;
|
||||
}
|
||||
for (unsigned i = has_interrupts? 0x58 : 0x40; i <= 0x60; i += 8) {
|
||||
gb->rom[i] = 0xc9; // ret
|
||||
gb->rom[i] = 0xC9; // ret
|
||||
}
|
||||
|
||||
// Generate entry
|
||||
@ -703,7 +703,7 @@ error:
|
||||
|
||||
void GB_load_rom_from_buffer(GB_gameboy_t *gb, const uint8_t *buffer, size_t size)
|
||||
{
|
||||
gb->rom_size = (size + 0x3fff) & ~0x3fff;
|
||||
gb->rom_size = (size + 0x3FFF) & ~0x3FFF;
|
||||
while (gb->rom_size & (gb->rom_size - 1)) {
|
||||
gb->rom_size |= gb->rom_size >> 1;
|
||||
gb->rom_size++;
|
||||
@ -715,7 +715,7 @@ void GB_load_rom_from_buffer(GB_gameboy_t *gb, const uint8_t *buffer, size_t siz
|
||||
free(gb->rom);
|
||||
}
|
||||
gb->rom = malloc(gb->rom_size);
|
||||
memset(gb->rom, 0xff, gb->rom_size);
|
||||
memset(gb->rom, 0xFF, gb->rom_size);
|
||||
memcpy(gb->rom, buffer, size);
|
||||
GB_configure_cart(gb);
|
||||
gb->tried_loading_sgb_border = false;
|
||||
@ -1219,10 +1219,10 @@ void GB_set_lcd_line_callback(GB_gameboy_t *gb, GB_lcd_line_callback_t callback)
|
||||
gb->lcd_line_callback = callback;
|
||||
}
|
||||
|
||||
const GB_palette_t GB_PALETTE_GREY = {{{0x00, 0x00, 0x00}, {0x55, 0x55, 0x55}, {0xaa, 0xaa, 0xaa}, {0xff, 0xff, 0xff}, {0xff, 0xff, 0xff}}};
|
||||
const GB_palette_t GB_PALETTE_DMG = {{{0x08, 0x18, 0x10}, {0x39, 0x61, 0x39}, {0x84, 0xa5, 0x63}, {0xc6, 0xde, 0x8c}, {0xd2, 0xe6, 0xa6}}};
|
||||
const GB_palette_t GB_PALETTE_MGB = {{{0x07, 0x10, 0x0e}, {0x3a, 0x4c, 0x3a}, {0x81, 0x8d, 0x66}, {0xc2, 0xce, 0x93}, {0xcf, 0xda, 0xac}}};
|
||||
const GB_palette_t GB_PALETTE_GBL = {{{0x0a, 0x1c, 0x15}, {0x35, 0x78, 0x62}, {0x56, 0xb4, 0x95}, {0x7f, 0xe2, 0xc3}, {0x91, 0xea, 0xd0}}};
|
||||
const GB_palette_t GB_PALETTE_GREY = {{{0x00, 0x00, 0x00}, {0x55, 0x55, 0x55}, {0xAA, 0xAA, 0xAA}, {0xFF, 0xFF, 0xFF}, {0xFF, 0xFF, 0xFF}}};
|
||||
const GB_palette_t GB_PALETTE_DMG = {{{0x08, 0x18, 0x10}, {0x39, 0x61, 0x39}, {0x84, 0xA5, 0x63}, {0xC6, 0xDE, 0x8C}, {0xD2, 0xE6, 0xA6}}};
|
||||
const GB_palette_t GB_PALETTE_MGB = {{{0x07, 0x10, 0x0E}, {0x3A, 0x4C, 0x3A}, {0x81, 0x8D, 0x66}, {0xC2, 0xCE, 0x93}, {0xCF, 0xDA, 0xAC}}};
|
||||
const GB_palette_t GB_PALETTE_GBL = {{{0x0A, 0x1C, 0x15}, {0x35, 0x78, 0x62}, {0x56, 0xB4, 0x95}, {0x7F, 0xE2, 0xC3}, {0x91, 0xEA, 0xD0}}};
|
||||
|
||||
static void update_dmg_palette(GB_gameboy_t *gb)
|
||||
{
|
||||
@ -1639,7 +1639,7 @@ void GB_reset(GB_gameboy_t *gb)
|
||||
gb->io_registers[GB_IO_DMA] = gb->io_registers[GB_IO_OBP0] = gb->io_registers[GB_IO_OBP1] = GB_is_cgb(gb)? 0x00 : 0xFF;
|
||||
|
||||
gb->accessed_oam_row = -1;
|
||||
gb->dma_current_dest = 0xa1;
|
||||
gb->dma_current_dest = 0xA1;
|
||||
|
||||
if (GB_is_hle_sgb(gb)) {
|
||||
if (!gb->sgb) {
|
||||
@ -1905,49 +1905,49 @@ void GB_get_rom_title(GB_gameboy_t *gb, char *title)
|
||||
uint32_t GB_get_rom_crc32(GB_gameboy_t *gb)
|
||||
{
|
||||
static const uint32_t table[] = {
|
||||
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
|
||||
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
|
||||
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
|
||||
0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
|
||||
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
|
||||
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
|
||||
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
|
||||
0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
|
||||
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
|
||||
0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
|
||||
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
|
||||
0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
|
||||
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
|
||||
0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
|
||||
0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
|
||||
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
|
||||
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
|
||||
0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
|
||||
0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
|
||||
0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
|
||||
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
|
||||
0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
|
||||
0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
|
||||
0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
|
||||
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
|
||||
0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
|
||||
0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
|
||||
0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
|
||||
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
|
||||
0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
|
||||
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
|
||||
0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
|
||||
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
|
||||
0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
|
||||
0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
|
||||
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
|
||||
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
|
||||
0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
|
||||
0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
|
||||
0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
|
||||
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
|
||||
0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
|
||||
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
|
||||
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F,
|
||||
0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
|
||||
0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2,
|
||||
0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
|
||||
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9,
|
||||
0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
|
||||
0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C,
|
||||
0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
|
||||
0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423,
|
||||
0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
|
||||
0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106,
|
||||
0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
|
||||
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D,
|
||||
0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
|
||||
0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950,
|
||||
0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
|
||||
0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7,
|
||||
0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
|
||||
0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA,
|
||||
0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
|
||||
0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81,
|
||||
0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
|
||||
0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84,
|
||||
0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
|
||||
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB,
|
||||
0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
|
||||
0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E,
|
||||
0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
|
||||
0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55,
|
||||
0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
|
||||
0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28,
|
||||
0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
|
||||
0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F,
|
||||
0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
|
||||
0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242,
|
||||
0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
|
||||
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69,
|
||||
0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
|
||||
0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC,
|
||||
0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
|
||||
0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693,
|
||||
0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
|
||||
0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
|
||||
};
|
||||
|
||||
const uint8_t *byte = gb->rom;
|
||||
|
32
Core/gb.h
32
Core/gb.h
@ -161,7 +161,7 @@ enum {
|
||||
|
||||
/* Missing */
|
||||
|
||||
GB_IO_IF = 0x0f, // Interrupt Flag (R/W)
|
||||
GB_IO_IF = 0x0F, // Interrupt Flag (R/W)
|
||||
|
||||
/* Sound */
|
||||
GB_IO_NR10 = 0x10, // Channel 1 Sweep register (R/W)
|
||||
@ -174,11 +174,11 @@ enum {
|
||||
GB_IO_NR22 = 0x17, // Channel 2 Volume Envelope (R/W)
|
||||
GB_IO_NR23 = 0x18, // Channel 2 Frequency lo data (W)
|
||||
GB_IO_NR24 = 0x19, // Channel 2 Frequency hi data (R/W)
|
||||
GB_IO_NR30 = 0x1a, // Channel 3 Sound on/off (R/W)
|
||||
GB_IO_NR31 = 0x1b, // Channel 3 Sound Length
|
||||
GB_IO_NR32 = 0x1c, // Channel 3 Select output level (R/W)
|
||||
GB_IO_NR33 = 0x1d, // Channel 3 Frequency's lower data (W)
|
||||
GB_IO_NR34 = 0x1e, // Channel 3 Frequency's higher data (R/W)
|
||||
GB_IO_NR30 = 0x1A, // Channel 3 Sound on/off (R/W)
|
||||
GB_IO_NR31 = 0x1B, // Channel 3 Sound Length
|
||||
GB_IO_NR32 = 0x1C, // Channel 3 Select output level (R/W)
|
||||
GB_IO_NR33 = 0x1D, // Channel 3 Frequency's lower data (W)
|
||||
GB_IO_NR34 = 0x1E, // Channel 3 Frequency's higher data (R/W)
|
||||
/* NR40 does not exist */
|
||||
GB_IO_NR41 = 0x20, // Channel 4 Sound Length (R/W)
|
||||
GB_IO_NR42 = 0x21, // Channel 4 Volume Envelope (R/W)
|
||||
@ -191,7 +191,7 @@ enum {
|
||||
/* Missing */
|
||||
|
||||
GB_IO_WAV_START = 0x30, // Wave pattern start
|
||||
GB_IO_WAV_END = 0x3f, // Wave pattern end
|
||||
GB_IO_WAV_END = 0x3F, // Wave pattern end
|
||||
|
||||
/* Graphics */
|
||||
GB_IO_LCDC = 0x40, // LCD Control (R/W)
|
||||
@ -204,17 +204,17 @@ enum {
|
||||
GB_IO_BGP = 0x47, // BG Palette Data (R/W) - Non CGB Mode Only
|
||||
GB_IO_OBP0 = 0x48, // Object Palette 0 Data (R/W) - Non CGB Mode Only
|
||||
GB_IO_OBP1 = 0x49, // Object Palette 1 Data (R/W) - Non CGB Mode Only
|
||||
GB_IO_WY = 0x4a, // Window Y Position (R/W)
|
||||
GB_IO_WX = 0x4b, // Window X Position minus 7 (R/W)
|
||||
GB_IO_WY = 0x4A, // Window Y Position (R/W)
|
||||
GB_IO_WX = 0x4B, // Window X Position minus 7 (R/W)
|
||||
// Controls DMG mode and PGB mode
|
||||
GB_IO_KEY0 = 0x4c,
|
||||
GB_IO_KEY0 = 0x4C,
|
||||
|
||||
/* General CGB features */
|
||||
GB_IO_KEY1 = 0x4d, // CGB Mode Only - Prepare Speed Switch
|
||||
GB_IO_KEY1 = 0x4D, // CGB Mode Only - Prepare Speed Switch
|
||||
|
||||
/* Missing */
|
||||
|
||||
GB_IO_VBK = 0x4f, // CGB Mode Only - VRAM Bank
|
||||
GB_IO_VBK = 0x4F, // CGB Mode Only - VRAM Bank
|
||||
GB_IO_BANK = 0x50, // Write to disable the BIOS mapping
|
||||
|
||||
/* CGB DMA */
|
||||
@ -232,9 +232,9 @@ enum {
|
||||
/* CGB Palettes */
|
||||
GB_IO_BGPI = 0x68, // CGB Mode Only - Background Palette Index
|
||||
GB_IO_BGPD = 0x69, // CGB Mode Only - Background Palette Data
|
||||
GB_IO_OBPI = 0x6a, // CGB Mode Only - Object Palette Index
|
||||
GB_IO_OBPD = 0x6b, // CGB Mode Only - Object Palette Data
|
||||
GB_IO_OPRI = 0x6c, // Affects object priority (X based or index based)
|
||||
GB_IO_OBPI = 0x6A, // CGB Mode Only - Object Palette Index
|
||||
GB_IO_OBPD = 0x6B, // CGB Mode Only - Object Palette Data
|
||||
GB_IO_OPRI = 0x6C, // Affects object priority (X based or index based)
|
||||
|
||||
/* Missing */
|
||||
|
||||
@ -410,7 +410,7 @@ struct GB_gameboy_internal_s {
|
||||
/* Misc state */
|
||||
bool infrared_input;
|
||||
GB_printer_t printer;
|
||||
uint8_t extra_oam[0xff00 - 0xfea0];
|
||||
uint8_t extra_oam[0xFF00 - 0xFEA0];
|
||||
uint32_t ram_size; // Different between CGB and DMG
|
||||
GB_workboy_t workboy;
|
||||
|
||||
|
@ -129,9 +129,9 @@ void GB_update_mbc_mappings(GB_gameboy_t *gb)
|
||||
void GB_configure_cart(GB_gameboy_t *gb)
|
||||
{
|
||||
gb->cartridge_type = &GB_cart_defs[gb->rom[0x147]];
|
||||
if (gb->rom[0x147] == 0xbc &&
|
||||
gb->rom[0x149] == 0xc1 &&
|
||||
gb->rom[0x14a] == 0x65) {
|
||||
if (gb->rom[0x147] == 0xBC &&
|
||||
gb->rom[0x149] == 0xC1 &&
|
||||
gb->rom[0x14A] == 0x65) {
|
||||
static const GB_cartridge_t tpp1 = {GB_TPP1, GB_STANDARD_MBC, true, true, true, true};
|
||||
gb->cartridge_type = &tpp1;
|
||||
gb->tpp1.rom_bank = 1;
|
||||
|
118
Core/memory.c
118
Core/memory.c
@ -95,7 +95,7 @@ void GB_trigger_oam_bug(GB_gameboy_t *gb, uint16_t address)
|
||||
|
||||
if (address >= 0xFE00 && address < 0xFF00) {
|
||||
GB_display_sync(gb);
|
||||
if (gb->accessed_oam_row != 0xff && gb->accessed_oam_row >= 8) {
|
||||
if (gb->accessed_oam_row != 0xFF && gb->accessed_oam_row >= 8) {
|
||||
uint16_t *base = (uint16_t *)(gb->oam + gb->accessed_oam_row);
|
||||
base[0] = bitwise_glitch(base[0],
|
||||
base[-4],
|
||||
@ -197,7 +197,7 @@ void GB_trigger_oam_bug_read(GB_gameboy_t *gb, uint16_t address)
|
||||
if (GB_is_cgb(gb)) return;
|
||||
|
||||
if (address >= 0xFE00 && address < 0xFF00) {
|
||||
if (gb->accessed_oam_row != 0xff && gb->accessed_oam_row >= 8) {
|
||||
if (gb->accessed_oam_row != 0xFF && gb->accessed_oam_row >= 8) {
|
||||
if ((gb->accessed_oam_row & 0x18) == 0x10) {
|
||||
oam_bug_secondary_read_corruption(gb);
|
||||
}
|
||||
@ -251,16 +251,16 @@ void GB_trigger_oam_bug_read(GB_gameboy_t *gb, uint16_t address)
|
||||
|
||||
static bool is_addr_in_dma_use(GB_gameboy_t *gb, uint16_t addr)
|
||||
{
|
||||
if (!GB_is_dma_active(gb) || addr >= 0xfe00 || gb->hdma_in_progress) return false;
|
||||
if (!GB_is_dma_active(gb) || addr >= 0xFE00 || gb->hdma_in_progress) return false;
|
||||
if (gb->dma_current_dest == 0xFF || gb->dma_current_dest == 0x0) return false; // Warm up
|
||||
if (addr >= 0xfe00) return false;
|
||||
if (addr >= 0xFE00) return false;
|
||||
if (gb->dma_current_src == addr) return false; // Shortcut for DMA access flow
|
||||
if (gb->dma_current_src >= 0xe000 && (gb->dma_current_src & ~0x2000) == addr) return false;
|
||||
if (gb->dma_current_src >= 0xE000 && (gb->dma_current_src & ~0x2000) == addr) return false;
|
||||
if (GB_is_cgb(gb)) {
|
||||
if (addr >= 0xc000) {
|
||||
if (addr >= 0xC000) {
|
||||
return bus_for_addr(gb, gb->dma_current_src) != GB_BUS_VRAM;
|
||||
}
|
||||
if (gb->dma_current_src >= 0xe000) {
|
||||
if (gb->dma_current_src >= 0xE000) {
|
||||
return bus_for_addr(gb, addr) != GB_BUS_VRAM;
|
||||
}
|
||||
}
|
||||
@ -390,7 +390,7 @@ static uint8_t read_mbc_ram(GB_gameboy_t *gb, uint16_t addr)
|
||||
}
|
||||
|
||||
if (gb->cartridge_type->mbc_type == GB_HUC1 && gb->huc1.ir_mode) {
|
||||
return 0xc0 | gb->effective_ir_input;
|
||||
return 0xC0 | gb->effective_ir_input;
|
||||
}
|
||||
|
||||
if (gb->cartridge_type->has_rtc && gb->cartridge_type->mbc_type != GB_HUC3 &&
|
||||
@ -414,8 +414,8 @@ static uint8_t read_mbc_ram(GB_gameboy_t *gb, uint16_t addr)
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
if (gb->cartridge_type->mbc_subtype == GB_CAMERA && gb->mbc_ram_bank == 0 && addr >= 0xa100 && addr < 0xaf00) {
|
||||
return GB_camera_read_image(gb, addr - 0xa100);
|
||||
if (gb->cartridge_type->mbc_subtype == GB_CAMERA && gb->mbc_ram_bank == 0 && addr >= 0xA100 && addr < 0xAF00) {
|
||||
return GB_camera_read_image(gb, addr - 0xA100);
|
||||
}
|
||||
|
||||
uint8_t effective_bank = gb->mbc_ram_bank;
|
||||
@ -475,7 +475,7 @@ static inline void sync_ppu_if_needed(GB_gameboy_t *gb, uint8_t register_accesse
|
||||
|
||||
internal uint8_t GB_read_oam(GB_gameboy_t *gb, uint8_t addr)
|
||||
{
|
||||
if (addr < 0xa0) {
|
||||
if (addr < 0xA0) {
|
||||
return gb->oam[addr];
|
||||
}
|
||||
|
||||
@ -485,17 +485,17 @@ internal uint8_t GB_read_oam(GB_gameboy_t *gb, uint8_t addr)
|
||||
return (addr & 0xF0) | (addr >> 4);
|
||||
|
||||
case GB_MODEL_CGB_D:
|
||||
if (addr >= 0xc0) {
|
||||
addr |= 0xf0;
|
||||
if (addr >= 0xC0) {
|
||||
addr |= 0xF0;
|
||||
}
|
||||
return gb->extra_oam[addr - 0xa0];
|
||||
return gb->extra_oam[addr - 0xA0];
|
||||
|
||||
case GB_MODEL_CGB_C:
|
||||
case GB_MODEL_CGB_B:
|
||||
case GB_MODEL_CGB_A:
|
||||
case GB_MODEL_CGB_0:
|
||||
addr &= ~0x18;
|
||||
return gb->extra_oam[addr - 0xa0];
|
||||
return gb->extra_oam[addr - 0xA0];
|
||||
|
||||
case GB_MODEL_DMG_B:
|
||||
case GB_MODEL_MGB:
|
||||
@ -522,12 +522,12 @@ static uint8_t read_high_memory(GB_gameboy_t *gb, uint16_t addr)
|
||||
if (!gb->disable_oam_corruption) {
|
||||
GB_trigger_oam_bug_read(gb, addr);
|
||||
}
|
||||
return 0xff;
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
if (GB_is_dma_active(gb)) {
|
||||
/* Todo: Does reading from OAM during DMA causes the OAM bug? */
|
||||
return 0xff;
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
if (gb->oam_read_blocked) {
|
||||
@ -535,20 +535,20 @@ static uint8_t read_high_memory(GB_gameboy_t *gb, uint16_t addr)
|
||||
if (addr < 0xFEA0) {
|
||||
uint16_t *oam = (uint16_t *)gb->oam;
|
||||
if (gb->accessed_oam_row == 0) {
|
||||
oam[(addr & 0xf8) >> 1] =
|
||||
oam[(addr & 0xF8) >> 1] =
|
||||
oam[0] = bitwise_glitch_read(oam[0],
|
||||
oam[(addr & 0xf8) >> 1],
|
||||
oam[(addr & 0xff) >> 1]);
|
||||
oam[(addr & 0xF8) >> 1],
|
||||
oam[(addr & 0xFF) >> 1]);
|
||||
|
||||
for (unsigned i = 2; i < 8; i++) {
|
||||
gb->oam[i] = gb->oam[(addr & 0xf8) + i];
|
||||
gb->oam[i] = gb->oam[(addr & 0xF8) + i];
|
||||
}
|
||||
}
|
||||
else if (gb->accessed_oam_row == 0xa0) {
|
||||
else if (gb->accessed_oam_row == 0xA0) {
|
||||
uint8_t target = (addr & 7) | 0x98;
|
||||
uint16_t a = oam[0x9c >> 1],
|
||||
uint16_t a = oam[0x9C >> 1],
|
||||
b = oam[target >> 1],
|
||||
c = oam[(addr & 0xf8) >> 1];
|
||||
c = oam[(addr & 0xF8) >> 1];
|
||||
switch (addr & 7) {
|
||||
case 0:
|
||||
case 1:
|
||||
@ -563,7 +563,7 @@ static uint8_t read_high_memory(GB_gameboy_t *gb, uint16_t addr)
|
||||
case 2:
|
||||
case 3: {
|
||||
/* Probably instance specific */
|
||||
c = oam[(addr & 0xfe) >> 1];
|
||||
c = oam[(addr & 0xFE) >> 1];
|
||||
|
||||
// MGB only: oam[target >> 1] = bitwise_glitch_read(a, b, c);
|
||||
oam[target >> 1] = (a & b) | (a & c) | (b & c);
|
||||
@ -581,12 +581,12 @@ static uint8_t read_high_memory(GB_gameboy_t *gb, uint16_t addr)
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < 8; i++) {
|
||||
gb->oam[(addr & 0xf8) + i] = gb->oam[0x98 + i];
|
||||
gb->oam[(addr & 0xF8) + i] = gb->oam[0x98 + i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0xff;
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
return GB_read_oam(gb, addr);
|
||||
@ -743,16 +743,16 @@ uint8_t GB_read_memory(GB_gameboy_t *gb, uint16_t addr)
|
||||
GB_debugger_test_read_watchpoint(gb, addr);
|
||||
}
|
||||
if (unlikely(is_addr_in_dma_use(gb, addr))) {
|
||||
if (GB_is_cgb(gb) && bus_for_addr(gb, addr) == GB_BUS_MAIN && gb->dma_current_src >= 0xe000) {
|
||||
if (GB_is_cgb(gb) && bus_for_addr(gb, addr) == GB_BUS_MAIN && gb->dma_current_src >= 0xE000) {
|
||||
/* This is cart specific! Everdrive 7X on a CGB-A or 0 behaves differently. */
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
if (GB_is_cgb(gb) && bus_for_addr(gb, gb->dma_current_src) != GB_BUS_RAM && addr >= 0xc000) {
|
||||
if (GB_is_cgb(gb) && bus_for_addr(gb, gb->dma_current_src) != GB_BUS_RAM && addr >= 0xC000) {
|
||||
// TODO: this should probably affect the DMA dest as well
|
||||
addr = ((gb->dma_current_src - 1) & 0x1000) | (addr & 0xFFF) | 0xC000;
|
||||
}
|
||||
else if (GB_is_cgb(gb) && gb->dma_current_src >= 0xe000 && addr >= 0xc000) {
|
||||
else if (GB_is_cgb(gb) && gb->dma_current_src >= 0xE000 && addr >= 0xC000) {
|
||||
// TODO: this should probably affect the DMA dest as well
|
||||
addr = ((gb->dma_current_src - 1) & 0x1000) | (addr & 0xFFF) | 0xC000;
|
||||
}
|
||||
@ -945,15 +945,15 @@ static bool huc3_write(GB_gameboy_t *gb, uint8_t value)
|
||||
gb->huc3.days &= ~(0xF << ((gb->huc3.access_index - 3) * 4));
|
||||
gb->huc3.days |= ((value & 0xF) << ((gb->huc3.access_index - 3) * 4));
|
||||
}
|
||||
else if (gb->huc3.access_index >= 0x58 && gb->huc3.access_index <= 0x5a) {
|
||||
else if (gb->huc3.access_index >= 0x58 && gb->huc3.access_index <= 0x5A) {
|
||||
gb->huc3.alarm_minutes &= ~(0xF << ((gb->huc3.access_index - 0x58) * 4));
|
||||
gb->huc3.alarm_minutes |= ((value & 0xF) << ((gb->huc3.access_index - 0x58) * 4));
|
||||
}
|
||||
else if (gb->huc3.access_index >= 0x5b && gb->huc3.access_index <= 0x5e) {
|
||||
gb->huc3.alarm_days &= ~(0xF << ((gb->huc3.access_index - 0x5b) * 4));
|
||||
gb->huc3.alarm_days |= ((value & 0xF) << ((gb->huc3.access_index - 0x5b) * 4));
|
||||
else if (gb->huc3.access_index >= 0x5B && gb->huc3.access_index <= 0x5E) {
|
||||
gb->huc3.alarm_days &= ~(0xF << ((gb->huc3.access_index - 0x5B) * 4));
|
||||
gb->huc3.alarm_days |= ((value & 0xF) << ((gb->huc3.access_index - 0x5B) * 4));
|
||||
}
|
||||
else if (gb->huc3.access_index == 0x5f) {
|
||||
else if (gb->huc3.access_index == 0x5F) {
|
||||
gb->huc3.alarm_enabled = value & 1;
|
||||
}
|
||||
else {
|
||||
@ -1200,23 +1200,23 @@ static void write_banked_ram(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
|
||||
|
||||
static void write_oam(GB_gameboy_t *gb, uint8_t addr, uint8_t value)
|
||||
{
|
||||
if (addr < 0xa0) {
|
||||
if (addr < 0xA0) {
|
||||
gb->oam[addr] = value;
|
||||
return;
|
||||
}
|
||||
switch (gb->model) {
|
||||
case GB_MODEL_CGB_D:
|
||||
if (addr >= 0xc0) {
|
||||
addr |= 0xf0;
|
||||
if (addr >= 0xC0) {
|
||||
addr |= 0xF0;
|
||||
}
|
||||
gb->extra_oam[addr - 0xa0] = value;
|
||||
gb->extra_oam[addr - 0xA0] = value;
|
||||
break;
|
||||
case GB_MODEL_CGB_C:
|
||||
case GB_MODEL_CGB_B:
|
||||
case GB_MODEL_CGB_A:
|
||||
case GB_MODEL_CGB_0:
|
||||
addr &= ~0x18;
|
||||
gb->extra_oam[addr - 0xa0] = value;
|
||||
gb->extra_oam[addr - 0xA0] = value;
|
||||
break;
|
||||
case GB_MODEL_CGB_E:
|
||||
case GB_MODEL_AGB_A:
|
||||
@ -1258,13 +1258,13 @@ static void write_high_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
|
||||
}
|
||||
|
||||
if (addr < 0xFEA0) {
|
||||
if (gb->accessed_oam_row == 0xa0) {
|
||||
if (gb->accessed_oam_row == 0xA0) {
|
||||
for (unsigned i = 0; i < 8; i++) {
|
||||
if ((i & 6) != (addr & 6)) {
|
||||
gb->oam[(addr & 0xf8) + i] = gb->oam[0x98 + i];
|
||||
gb->oam[(addr & 0xF8) + i] = gb->oam[0x98 + i];
|
||||
}
|
||||
else {
|
||||
gb->oam[(addr & 0xf8) + i] = bitwise_glitch(gb->oam[(addr & 0xf8) + i], gb->oam[0x9c], gb->oam[0x98 + i]);
|
||||
gb->oam[(addr & 0xF8) + i] = bitwise_glitch(gb->oam[(addr & 0xF8) + i], gb->oam[0x9C], gb->oam[0x98 + i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1273,13 +1273,13 @@ static void write_high_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
|
||||
|
||||
if (gb->accessed_oam_row == 0) {
|
||||
gb->oam[0] = bitwise_glitch(gb->oam[0],
|
||||
gb->oam[(addr & 0xf8)],
|
||||
gb->oam[(addr & 0xfe)]);
|
||||
gb->oam[(addr & 0xF8)],
|
||||
gb->oam[(addr & 0xFE)]);
|
||||
gb->oam[1] = bitwise_glitch(gb->oam[1],
|
||||
gb->oam[(addr & 0xf8) + 1],
|
||||
gb->oam[(addr & 0xfe) | 1]);
|
||||
gb->oam[(addr & 0xF8) + 1],
|
||||
gb->oam[(addr & 0xFE) | 1]);
|
||||
for (unsigned i = 2; i < 8; i++) {
|
||||
gb->oam[i] = gb->oam[(addr & 0xf8) + i];
|
||||
gb->oam[i] = gb->oam[(addr & 0xF8) + i];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1656,25 +1656,25 @@ void GB_write_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
|
||||
|
||||
if (unlikely(is_addr_in_dma_use(gb, addr))) {
|
||||
bool oam_write = addr >= 0xFE00;
|
||||
if (GB_is_cgb(gb) && bus_for_addr(gb, addr) == GB_BUS_MAIN && gb->dma_current_src >= 0xe000) {
|
||||
if (GB_is_cgb(gb) && bus_for_addr(gb, addr) == GB_BUS_MAIN && gb->dma_current_src >= 0xE000) {
|
||||
/* This is cart specific! Everdrive 7X on a CGB-A or 0 behaves differently. */
|
||||
return;
|
||||
}
|
||||
|
||||
if (GB_is_cgb(gb) && (gb->dma_current_src < 0xc000 || gb->dma_current_src >= 0xe000) && addr >= 0xc000) {
|
||||
if (GB_is_cgb(gb) && (gb->dma_current_src < 0xC000 || gb->dma_current_src >= 0xE000) && addr >= 0xC000) {
|
||||
// TODO: this should probably affect the DMA dest as well
|
||||
addr = ((gb->dma_current_src - 1) & 0x1000) | (addr & 0xFFF) | 0xC000;
|
||||
goto write;
|
||||
}
|
||||
else if (GB_is_cgb(gb) && gb->dma_current_src >= 0xe000 && addr >= 0xc000) {
|
||||
else if (GB_is_cgb(gb) && gb->dma_current_src >= 0xE000 && addr >= 0xC000) {
|
||||
// TODO: this should probably affect the DMA dest as well
|
||||
addr = ((gb->dma_current_src - 1) & 0x1000) | (addr & 0xFFF) | 0xC000;
|
||||
}
|
||||
else {
|
||||
addr = (gb->dma_current_src - 1);
|
||||
}
|
||||
if (GB_is_cgb(gb) || addr >= 0xa000) {
|
||||
if (addr < 0xa000) {
|
||||
if (GB_is_cgb(gb) || addr >= 0xA000) {
|
||||
if (addr < 0xA000) {
|
||||
gb->oam[gb->dma_current_dest - 1] = 0;
|
||||
}
|
||||
else if ((gb->model < GB_MODEL_CGB_0 || gb->model == GB_MODEL_CGB_B)) {
|
||||
@ -1683,7 +1683,7 @@ void GB_write_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
|
||||
else if ((gb->model < GB_MODEL_CGB_C || gb->model > GB_MODEL_CGB_E) && !oam_write) {
|
||||
gb->oam[gb->dma_current_dest - 1] = value;
|
||||
}
|
||||
if (gb->model < GB_MODEL_CGB_E || addr >= 0xa000) return;
|
||||
if (gb->model < GB_MODEL_CGB_E || addr >= 0xA000) return;
|
||||
}
|
||||
}
|
||||
write:
|
||||
@ -1692,18 +1692,18 @@ write:
|
||||
|
||||
bool GB_is_dma_active(GB_gameboy_t *gb)
|
||||
{
|
||||
return gb->dma_current_dest != 0xa1;
|
||||
return gb->dma_current_dest != 0xA1;
|
||||
}
|
||||
|
||||
void GB_dma_run(GB_gameboy_t *gb)
|
||||
{
|
||||
if (gb->dma_current_dest == 0xa1) return;
|
||||
if (gb->dma_current_dest == 0xA1) return;
|
||||
if (unlikely(gb->halted || gb->stopped)) return;
|
||||
signed cycles = gb->dma_cycles + gb->dma_cycles_modulo;
|
||||
gb->in_dma_read = true;
|
||||
while (unlikely(cycles >= 4)) {
|
||||
cycles -= 4;
|
||||
if (gb->dma_current_dest >= 0xa0) {
|
||||
if (gb->dma_current_dest >= 0xA0) {
|
||||
gb->dma_current_dest++;
|
||||
if (gb->display_state == 8) {
|
||||
gb->io_registers[GB_IO_STAT] |= 2;
|
||||
@ -1714,7 +1714,7 @@ void GB_dma_run(GB_gameboy_t *gb)
|
||||
if (unlikely(gb->hdma_in_progress && (gb->hdma_steps_left > 1 || (gb->hdma_current_dest & 0xF) != 0xF))) {
|
||||
gb->dma_current_dest++;
|
||||
}
|
||||
else if (gb->dma_current_src < 0xe000) {
|
||||
else if (gb->dma_current_src < 0xE000) {
|
||||
gb->oam[gb->dma_current_dest++] = GB_read_memory(gb, gb->dma_current_src);
|
||||
}
|
||||
else {
|
||||
@ -1778,7 +1778,7 @@ void GB_hdma_run(GB_gameboy_t *gb)
|
||||
}
|
||||
gb->hdma_open_bus = 0xFF;
|
||||
|
||||
if ((gb->hdma_current_dest & 0xf) == 0) {
|
||||
if ((gb->hdma_current_dest & 0xF) == 0) {
|
||||
if (--gb->hdma_steps_left == 0 || gb->hdma_current_dest == 0) {
|
||||
gb->hdma_on = false;
|
||||
gb->hdma_on_hblank = false;
|
||||
|
@ -22,8 +22,8 @@ static void handle_command(GB_gameboy_t *gb)
|
||||
gb->printer.status = 6; /* Printing */
|
||||
uint32_t image[gb->printer.image_offset];
|
||||
uint8_t palette = gb->printer.command_data[2];
|
||||
uint32_t colors[4] = {gb->rgb_encode_callback(gb, 0xff, 0xff, 0xff),
|
||||
gb->rgb_encode_callback(gb, 0xaa, 0xaa, 0xaa),
|
||||
uint32_t colors[4] = {gb->rgb_encode_callback(gb, 0xFF, 0xFF, 0xFF),
|
||||
gb->rgb_encode_callback(gb, 0xAA, 0xAA, 0xAA),
|
||||
gb->rgb_encode_callback(gb, 0x55, 0x55, 0x55),
|
||||
gb->rgb_encode_callback(gb, 0x00, 0x00, 0x00)};
|
||||
for (unsigned i = 0; i < gb->printer.image_offset; i++) {
|
||||
|
@ -17,7 +17,7 @@ static uint8_t *state_compress(const uint8_t *prev, const uint8_t *data, size_t
|
||||
|
||||
while (uncompressed_size) {
|
||||
if (prev_mode) {
|
||||
if (*data == *prev && COUNTER != 0xffff) {
|
||||
if (*data == *prev && COUNTER != 0xFFFF) {
|
||||
COUNTER++;
|
||||
data++;
|
||||
prev++;
|
||||
@ -35,7 +35,7 @@ static uint8_t *state_compress(const uint8_t *prev, const uint8_t *data, size_t
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (*data != *prev && COUNTER != 0xffff) {
|
||||
if (*data != *prev && COUNTER != 0xFFFF) {
|
||||
COUNTER++;
|
||||
DATA = *data;
|
||||
data_pos++;
|
||||
|
@ -544,7 +544,7 @@ static int save_state_internal(GB_gameboy_t *gb, virtual_file_t *file, bool appe
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (file->write(file, gb->rom + 0x14e, 2) != 2) {
|
||||
if (file->write(file, gb->rom + 0x14E, 2) != 2) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ static void command_ready(GB_gameboy_t *gb)
|
||||
return;
|
||||
}
|
||||
memcpy(&gb->sgb->received_header[index * 14], &gb->sgb->command[2], 14);
|
||||
if (gb->sgb->command[0] == 0xfb) {
|
||||
if (gb->sgb->command[0] == 0xFB) {
|
||||
if (gb->sgb->received_header[0x42] != 3 || gb->sgb->received_header[0x47] != 0x33) {
|
||||
gb->sgb->disable_commands = true;
|
||||
for (unsigned i = 0; i < sizeof(palette_assignments) / sizeof(palette_assignments[0]); i++) {
|
||||
|
@ -519,7 +519,7 @@ static void ld_da8_a(GB_gameboy_t *gb, uint8_t opcode, uint16_t *pc)
|
||||
{
|
||||
(*pc)++;
|
||||
uint8_t addr = GB_read_memory(gb, (*pc)++);
|
||||
const char *symbol = GB_debugger_name_for_address(gb, 0xff00 + addr);
|
||||
const char *symbol = GB_debugger_name_for_address(gb, 0xFF00 + addr);
|
||||
if (symbol) {
|
||||
GB_log(gb, "LDH [%s & $FF], a ; =$%02x\n", symbol, addr);
|
||||
}
|
||||
@ -532,7 +532,7 @@ static void ld_a_da8(GB_gameboy_t *gb, uint8_t opcode, uint16_t *pc)
|
||||
{
|
||||
(*pc)++;
|
||||
uint8_t addr = GB_read_memory(gb, (*pc)++);
|
||||
const char *symbol = GB_debugger_name_for_address(gb, 0xff00 + addr);
|
||||
const char *symbol = GB_debugger_name_for_address(gb, 0xFF00 + addr);
|
||||
if (symbol) {
|
||||
GB_log(gb, "LDH a, [%s & $FF] ; =$%02x\n", symbol, addr);
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ static void ir_run(GB_gameboy_t *gb, uint32_t cycles)
|
||||
{
|
||||
/* TODO: the way this thing works makes the CGB IR port behave inaccurately when used together with HUC1/3 IR ports*/
|
||||
if ((gb->model > GB_MODEL_CGB_E || !gb->cgb_mode) && gb->cartridge_type->mbc_type != GB_HUC1 && gb->cartridge_type->mbc_type != GB_HUC3) return;
|
||||
bool is_sensing = (gb->io_registers[GB_IO_RP] & 0xc0) == 0xc0 ||
|
||||
bool is_sensing = (gb->io_registers[GB_IO_RP] & 0xC0) == 0xC0 ||
|
||||
(gb->cartridge_type->mbc_type == GB_HUC1 && gb->huc1.ir_mode) ||
|
||||
(gb->cartridge_type->mbc_type == GB_HUC3 && gb->huc3.mode == 0xE);
|
||||
if (is_sensing && (gb->infrared_input || gb->cart_ir || (gb->io_registers[GB_IO_RP] & 1))) {
|
||||
|
@ -101,12 +101,12 @@ hacksByManufacturer = @{
|
||||
@{@"reportID": @(0x31), @"size":@1, @"offset":@0x47, @"usagePage":@(kHIDPage_Button), @"usage":@4},
|
||||
@{@"reportID": @(0x31), @"size":@1, @"offset":@0x48, @"usagePage":@(kHIDPage_Button), @"usage":@5},
|
||||
@{@"reportID": @(0x31), @"size":@1, @"offset":@0x49, @"usagePage":@(kHIDPage_Button), @"usage":@6},
|
||||
@{@"reportID": @(0x31), @"size":@1, @"offset":@0x4a, @"usagePage":@(kHIDPage_Button), @"usage":@7},
|
||||
@{@"reportID": @(0x31), @"size":@1, @"offset":@0x4b, @"usagePage":@(kHIDPage_Button), @"usage":@8},
|
||||
@{@"reportID": @(0x31), @"size":@1, @"offset":@0x4c, @"usagePage":@(kHIDPage_Button), @"usage":@9},
|
||||
@{@"reportID": @(0x31), @"size":@1, @"offset":@0x4d, @"usagePage":@(kHIDPage_Button), @"usage":@10},
|
||||
@{@"reportID": @(0x31), @"size":@1, @"offset":@0x4e, @"usagePage":@(kHIDPage_Button), @"usage":@11},
|
||||
@{@"reportID": @(0x31), @"size":@1, @"offset":@0x4f, @"usagePage":@(kHIDPage_Button), @"usage":@12},
|
||||
@{@"reportID": @(0x31), @"size":@1, @"offset":@0x4A, @"usagePage":@(kHIDPage_Button), @"usage":@7},
|
||||
@{@"reportID": @(0x31), @"size":@1, @"offset":@0x4B, @"usagePage":@(kHIDPage_Button), @"usage":@8},
|
||||
@{@"reportID": @(0x31), @"size":@1, @"offset":@0x4C, @"usagePage":@(kHIDPage_Button), @"usage":@9},
|
||||
@{@"reportID": @(0x31), @"size":@1, @"offset":@0x4D, @"usagePage":@(kHIDPage_Button), @"usage":@10},
|
||||
@{@"reportID": @(0x31), @"size":@1, @"offset":@0x4E, @"usagePage":@(kHIDPage_Button), @"usage":@11},
|
||||
@{@"reportID": @(0x31), @"size":@1, @"offset":@0x4F, @"usagePage":@(kHIDPage_Button), @"usage":@12},
|
||||
@{@"reportID": @(0x31), @"size":@1, @"offset":@0x50, @"usagePage":@(kHIDPage_Button), @"usage":@13},
|
||||
@{@"reportID": @(0x31), @"size":@1, @"offset":@0x51, @"usagePage":@(kHIDPage_Button), @"usage":@14},
|
||||
@{@"reportID": @(0x31), @"size":@1, @"offset":@0x52, @"usagePage":@(kHIDPage_Button), @"usage":@15},
|
||||
|
@ -596,16 +596,16 @@ typedef union {
|
||||
_lastVendorSpecificOutput.ds3Output = (JOYDualShock3Output){
|
||||
.reportID = 1,
|
||||
.led = {
|
||||
{.timeEnabled = 0xff, .dutyLength = 0x27, .enabled = 0x10, .dutyOff = 0, .dutyOn = 0x32},
|
||||
{.timeEnabled = 0xff, .dutyLength = 0x27, .enabled = 0x10, .dutyOff = 0, .dutyOn = 0x32},
|
||||
{.timeEnabled = 0xff, .dutyLength = 0x27, .enabled = 0x10, .dutyOff = 0, .dutyOn = 0x32},
|
||||
{.timeEnabled = 0xff, .dutyLength = 0x27, .enabled = 0x10, .dutyOff = 0, .dutyOn = 0x32},
|
||||
{.timeEnabled = 0xFF, .dutyLength = 0x27, .enabled = 0x10, .dutyOff = 0, .dutyOn = 0x32},
|
||||
{.timeEnabled = 0xFF, .dutyLength = 0x27, .enabled = 0x10, .dutyOff = 0, .dutyOn = 0x32},
|
||||
{.timeEnabled = 0xFF, .dutyLength = 0x27, .enabled = 0x10, .dutyOff = 0, .dutyOn = 0x32},
|
||||
{.timeEnabled = 0xFF, .dutyLength = 0x27, .enabled = 0x10, .dutyOff = 0, .dutyOn = 0x32},
|
||||
{.timeEnabled = 0, .dutyLength = 0, .enabled = 0, .dutyOff = 0, .dutyOn = 0},
|
||||
}
|
||||
};
|
||||
}
|
||||
if (_isSony) {
|
||||
_isDualSense = [(__bridge NSNumber *)IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductIDKey)) unsignedIntValue] == 0xce6;
|
||||
_isDualSense = [(__bridge NSNumber *)IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductIDKey)) unsignedIntValue] == 0xCE6;
|
||||
}
|
||||
|
||||
if (_isDualSense) {
|
||||
@ -888,55 +888,55 @@ typedef union {
|
||||
}
|
||||
_lastVendorSpecificOutput.dualsenseOutput.sequence += 0x10;
|
||||
static const uint32_t table[] = {
|
||||
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
|
||||
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
|
||||
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
|
||||
0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
|
||||
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
|
||||
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
|
||||
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
|
||||
0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
|
||||
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
|
||||
0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
|
||||
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
|
||||
0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
|
||||
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
|
||||
0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
|
||||
0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
|
||||
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
|
||||
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
|
||||
0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
|
||||
0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
|
||||
0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
|
||||
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
|
||||
0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
|
||||
0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
|
||||
0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
|
||||
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
|
||||
0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
|
||||
0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
|
||||
0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
|
||||
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
|
||||
0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
|
||||
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
|
||||
0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
|
||||
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
|
||||
0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
|
||||
0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
|
||||
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
|
||||
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
|
||||
0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
|
||||
0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
|
||||
0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
|
||||
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
|
||||
0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
|
||||
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
|
||||
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F,
|
||||
0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
|
||||
0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2,
|
||||
0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
|
||||
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9,
|
||||
0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
|
||||
0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C,
|
||||
0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
|
||||
0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423,
|
||||
0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
|
||||
0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106,
|
||||
0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
|
||||
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D,
|
||||
0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
|
||||
0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950,
|
||||
0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
|
||||
0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7,
|
||||
0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
|
||||
0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA,
|
||||
0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
|
||||
0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81,
|
||||
0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
|
||||
0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84,
|
||||
0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
|
||||
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB,
|
||||
0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
|
||||
0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E,
|
||||
0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
|
||||
0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55,
|
||||
0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
|
||||
0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28,
|
||||
0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
|
||||
0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F,
|
||||
0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
|
||||
0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242,
|
||||
0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
|
||||
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69,
|
||||
0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
|
||||
0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC,
|
||||
0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
|
||||
0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693,
|
||||
0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
|
||||
0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
|
||||
};
|
||||
|
||||
const uint8_t *byte = (void *)&_lastVendorSpecificOutput.dualsenseOutput;
|
||||
uint32_t size = sizeof(_lastVendorSpecificOutput.dualsenseOutput) - 4;
|
||||
uint32_t ret = 0xFFFFFFFF;
|
||||
ret = table[(ret ^ 0xa2) & 0xFF] ^ (ret >> 8);
|
||||
ret = table[(ret ^ 0xA2) & 0xFF] ^ (ret >> 8);
|
||||
|
||||
while (size--) {
|
||||
ret = table[(ret ^ *byte++) & 0xFF] ^ (ret >> 8);
|
||||
@ -1049,13 +1049,13 @@ typedef union {
|
||||
}
|
||||
else if (_isDualShock3) {
|
||||
_lastVendorSpecificOutput.ds3Output.reportID = 1;
|
||||
_lastVendorSpecificOutput.ds3Output.rumbleLeftDuration = _lastVendorSpecificOutput.ds3Output.rumbleRightDuration = _rumbleAmplitude? 0xff : 0;
|
||||
_lastVendorSpecificOutput.ds3Output.rumbleLeftStrength = _lastVendorSpecificOutput.ds3Output.rumbleRightStrength = round(_rumbleAmplitude * 0xff);
|
||||
_lastVendorSpecificOutput.ds3Output.rumbleLeftDuration = _lastVendorSpecificOutput.ds3Output.rumbleRightDuration = _rumbleAmplitude? 0xFF : 0;
|
||||
_lastVendorSpecificOutput.ds3Output.rumbleLeftStrength = _lastVendorSpecificOutput.ds3Output.rumbleRightStrength = round(_rumbleAmplitude * 0xFF);
|
||||
[self sendReport:[NSData dataWithBytes:&_lastVendorSpecificOutput.ds3Output length:sizeof(_lastVendorSpecificOutput.ds3Output)]];
|
||||
}
|
||||
else if (_isDualSense) {
|
||||
_lastVendorSpecificOutput.dualsenseOutput.rumbleLeftStrength = round(_rumbleAmplitude * _rumbleAmplitude * 0xff);
|
||||
_lastVendorSpecificOutput.dualsenseOutput.rumbleRightStrength = _rumbleAmplitude > 0.25 ? round(pow(_rumbleAmplitude - 0.25, 2) * 0xff) : 0;
|
||||
_lastVendorSpecificOutput.dualsenseOutput.rumbleLeftStrength = round(_rumbleAmplitude * _rumbleAmplitude * 0xFF);
|
||||
_lastVendorSpecificOutput.dualsenseOutput.rumbleRightStrength = _rumbleAmplitude > 0.25 ? round(pow(_rumbleAmplitude - 0.25, 2) * 0xFF) : 0;
|
||||
[self sendDualSenseOutput];
|
||||
}
|
||||
else {
|
||||
|
@ -794,7 +794,7 @@ mainloop(char *(*completer)(const char *substring, uintptr_t *context))
|
||||
move_word(true);
|
||||
complete_context = completion_length = 0;
|
||||
break;
|
||||
case MOD_ALT(0x7f): // ALT+Backspace
|
||||
case MOD_ALT(0x7F): // ALT+Backspace
|
||||
delete_word(false);
|
||||
complete_context = completion_length = 0;
|
||||
break;
|
||||
|
@ -7,7 +7,7 @@ extern const uint8_t font_max;
|
||||
#define GLYPH_HEIGHT 8
|
||||
#define GLYPH_WIDTH 6
|
||||
#define LEFT_ARROW_STRING "\x86"
|
||||
#define RIGHT_ARROW_STRING "\x7f"
|
||||
#define RIGHT_ARROW_STRING "\x7F"
|
||||
#define SELECTION_STRING RIGHT_ARROW_STRING
|
||||
#define CTRL_STRING "\x80\x81\x82"
|
||||
#define SHIFT_STRING "\x83"
|
||||
|
@ -62,52 +62,52 @@ STATIC vec4 scale(sampler2D image, vec2 position, vec2 input_resolution, vec2 ou
|
||||
if (is_different(w7, w4)) pattern |= 64;
|
||||
if (is_different(w8, w4)) pattern |= 128;
|
||||
|
||||
if ((P(0xbf,0x37) || P(0xdb,0x13)) && is_different(w1, w5)) {
|
||||
if ((P(0xBF,0x37) || P(0xDB,0x13)) && is_different(w1, w5)) {
|
||||
return interp_2px(w4, 3.0, w3, 1.0);
|
||||
}
|
||||
if ((P(0xdb,0x49) || P(0xef,0x6d)) && is_different(w7, w3)) {
|
||||
if ((P(0xDB,0x49) || P(0xEF,0x6D)) && is_different(w7, w3)) {
|
||||
return interp_2px(w4, 3.0, w1, 1.0);
|
||||
}
|
||||
if ((P(0x0b,0x0b) || P(0xfe,0x4a) || P(0xfe,0x1a)) && is_different(w3, w1)) {
|
||||
if ((P(0x0B,0x0B) || P(0xFE,0x4A) || P(0xFE,0x1A)) && is_different(w3, w1)) {
|
||||
return w4;
|
||||
}
|
||||
if ((P(0x6f,0x2a) || P(0x5b,0x0a) || P(0xbf,0x3a) || P(0xdf,0x5a) ||
|
||||
P(0x9f,0x8a) || P(0xcf,0x8a) || P(0xef,0x4e) || P(0x3f,0x0e) ||
|
||||
P(0xfb,0x5a) || P(0xbb,0x8a) || P(0x7f,0x5a) || P(0xaf,0x8a) ||
|
||||
P(0xeb,0x8a)) && is_different(w3, w1)) {
|
||||
if ((P(0x6F,0x2A) || P(0x5B,0x0A) || P(0xBF,0x3A) || P(0xDF,0x5A) ||
|
||||
P(0x9F,0x8A) || P(0xCF,0x8A) || P(0xEF,0x4E) || P(0x3F,0x0E) ||
|
||||
P(0xFB,0x5A) || P(0xBB,0x8A) || P(0x7F,0x5A) || P(0xAF,0x8A) ||
|
||||
P(0xEB,0x8A)) && is_different(w3, w1)) {
|
||||
return interp_2px(w4, 3.0, w0, 1.0);
|
||||
}
|
||||
if (P(0x0b,0x08)) {
|
||||
if (P(0x0B,0x08)) {
|
||||
return interp_3px(w4, 2.0, w0, 1.0, w1, 1.0);
|
||||
}
|
||||
if (P(0x0b,0x02)) {
|
||||
if (P(0x0B,0x02)) {
|
||||
return interp_3px(w4, 2.0, w0, 1.0, w3, 1.0);
|
||||
}
|
||||
if (P(0x2f,0x2f)) {
|
||||
if (P(0x2F,0x2F)) {
|
||||
return interp_3px(w4, 4.0, w3, 1.0, w1, 1.0);
|
||||
}
|
||||
if (P(0xbf,0x37) || P(0xdb,0x13)) {
|
||||
if (P(0xBF,0x37) || P(0xDB,0x13)) {
|
||||
return interp_3px(w4, 5.0, w1, 2.0, w3, 1.0);
|
||||
}
|
||||
if (P(0xdb,0x49) || P(0xef,0x6d)) {
|
||||
if (P(0xDB,0x49) || P(0xEF,0x6D)) {
|
||||
return interp_3px(w4, 5.0, w3, 2.0, w1, 1.0);
|
||||
}
|
||||
if (P(0x1b,0x03) || P(0x4f,0x43) || P(0x8b,0x83) || P(0x6b,0x43)) {
|
||||
if (P(0x1B,0x03) || P(0x4F,0x43) || P(0x8B,0x83) || P(0x6B,0x43)) {
|
||||
return interp_2px(w4, 3.0, w3, 1.0);
|
||||
}
|
||||
if (P(0x4b,0x09) || P(0x8b,0x89) || P(0x1f,0x19) || P(0x3b,0x19)) {
|
||||
if (P(0x4B,0x09) || P(0x8B,0x89) || P(0x1F,0x19) || P(0x3B,0x19)) {
|
||||
return interp_2px(w4, 3.0, w1, 1.0);
|
||||
}
|
||||
if (P(0x7e,0x2a) || P(0xef,0xab) || P(0xbf,0x8f) || P(0x7e,0x0e)) {
|
||||
if (P(0x7E,0x2A) || P(0xEF,0xAB) || P(0xBF,0x8F) || P(0x7E,0x0E)) {
|
||||
return interp_3px(w4, 2.0, w3, 3.0, w1, 3.0);
|
||||
}
|
||||
if (P(0xfb,0x6a) || P(0x6f,0x6e) || P(0x3f,0x3e) || P(0xfb,0xfa) ||
|
||||
P(0xdf,0xde) || P(0xdf,0x1e)) {
|
||||
if (P(0xFB,0x6A) || P(0x6F,0x6E) || P(0x3F,0x3E) || P(0xFB,0xFA) ||
|
||||
P(0xDF,0xDE) || P(0xDF,0x1E)) {
|
||||
return interp_2px(w4, 3.0, w0, 1.0);
|
||||
}
|
||||
if (P(0x0a,0x00) || P(0x4f,0x4b) || P(0x9f,0x1b) || P(0x2f,0x0b) ||
|
||||
P(0xbe,0x0a) || P(0xee,0x0a) || P(0x7e,0x0a) || P(0xeb,0x4b) ||
|
||||
P(0x3b,0x1b)) {
|
||||
if (P(0x0A,0x00) || P(0x4F,0x4B) || P(0x9F,0x1B) || P(0x2F,0x0B) ||
|
||||
P(0xBE,0x0A) || P(0xEE,0x0A) || P(0x7E,0x0A) || P(0xEB,0x4B) ||
|
||||
P(0x3B,0x1B)) {
|
||||
return interp_3px(w4, 2.0, w3, 1.0, w1, 1.0);
|
||||
}
|
||||
|
||||
|
@ -63,28 +63,28 @@ STATIC vec4 scale(sampler2D image, vec2 position, vec2 input_resolution, vec2 ou
|
||||
if (is_different(w7, w4)) pattern |= 1 << 6;
|
||||
if (is_different(w8, w4)) pattern |= 1 << 7;
|
||||
|
||||
if ((P(0xbf,0x37) || P(0xdb,0x13)) && is_different(w1, w5)) {
|
||||
if ((P(0xBF,0x37) || P(0xDB,0x13)) && is_different(w1, w5)) {
|
||||
return mix(w4, w3, 0.5 - p.x);
|
||||
}
|
||||
if ((P(0xdb,0x49) || P(0xef,0x6d)) && is_different(w7, w3)) {
|
||||
if ((P(0xDB,0x49) || P(0xEF,0x6D)) && is_different(w7, w3)) {
|
||||
return mix(w4, w1, 0.5 - p.y);
|
||||
}
|
||||
if ((P(0x0b,0x0b) || P(0xfe,0x4a) || P(0xfe,0x1a)) && is_different(w3, w1)) {
|
||||
if ((P(0x0B,0x0B) || P(0xFE,0x4A) || P(0xFE,0x1A)) && is_different(w3, w1)) {
|
||||
return w4;
|
||||
}
|
||||
if ((P(0x6f,0x2a) || P(0x5b,0x0a) || P(0xbf,0x3a) || P(0xdf,0x5a) ||
|
||||
P(0x9f,0x8a) || P(0xcf,0x8a) || P(0xef,0x4e) || P(0x3f,0x0e) ||
|
||||
P(0xfb,0x5a) || P(0xbb,0x8a) || P(0x7f,0x5a) || P(0xaf,0x8a) ||
|
||||
P(0xeb,0x8a)) && is_different(w3, w1)) {
|
||||
if ((P(0x6F,0x2A) || P(0x5B,0x0A) || P(0xBF,0x3A) || P(0xDF,0x5A) ||
|
||||
P(0x9F,0x8A) || P(0xCF,0x8A) || P(0xEF,0x4E) || P(0x3F,0x0E) ||
|
||||
P(0xFB,0x5A) || P(0xBB,0x8A) || P(0x7F,0x5A) || P(0xAF,0x8A) ||
|
||||
P(0xEB,0x8A)) && is_different(w3, w1)) {
|
||||
return mix(w4, mix(w4, w0, 0.5 - p.x), 0.5 - p.y);
|
||||
}
|
||||
if (P(0x0b,0x08)) {
|
||||
if (P(0x0B,0x08)) {
|
||||
return mix(mix(w0 * 0.375 + w1 * 0.25 + w4 * 0.375, w4 * 0.5 + w1 * 0.5, p.x * 2.0), w4, p.y * 2.0);
|
||||
}
|
||||
if (P(0x0b,0x02)) {
|
||||
if (P(0x0B,0x02)) {
|
||||
return mix(mix(w0 * 0.375 + w3 * 0.25 + w4 * 0.375, w4 * 0.5 + w3 * 0.5, p.y * 2.0), w4, p.x * 2.0);
|
||||
}
|
||||
if (P(0x2f,0x2f)) {
|
||||
if (P(0x2F,0x2F)) {
|
||||
float dist = length(p - vec2(0.5));
|
||||
float pixel_size = length(1.0 / (output_resolution / input_resolution));
|
||||
if (dist < 0.5 - pixel_size / 2) {
|
||||
@ -103,7 +103,7 @@ STATIC vec4 scale(sampler2D image, vec2 position, vec2 input_resolution, vec2 ou
|
||||
}
|
||||
return mix(w4, r, (dist - 0.5 + pixel_size / 2) / pixel_size);
|
||||
}
|
||||
if (P(0xbf,0x37) || P(0xdb,0x13)) {
|
||||
if (P(0xBF,0x37) || P(0xDB,0x13)) {
|
||||
float dist = p.x - 2.0 * p.y;
|
||||
float pixel_size = length(1.0 / (output_resolution / input_resolution)) * sqrt(5.0);
|
||||
if (dist > pixel_size / 2) {
|
||||
@ -115,7 +115,7 @@ STATIC vec4 scale(sampler2D image, vec2 position, vec2 input_resolution, vec2 ou
|
||||
}
|
||||
return mix(r, w1, (dist + pixel_size / 2) / pixel_size);
|
||||
}
|
||||
if (P(0xdb,0x49) || P(0xef,0x6d)) {
|
||||
if (P(0xDB,0x49) || P(0xEF,0x6D)) {
|
||||
float dist = p.y - 2.0 * p.x;
|
||||
float pixel_size = length(1.0 / (output_resolution / input_resolution)) * sqrt(5.0);
|
||||
if (p.y - 2.0 * p.x > pixel_size / 2) {
|
||||
@ -127,7 +127,7 @@ STATIC vec4 scale(sampler2D image, vec2 position, vec2 input_resolution, vec2 ou
|
||||
}
|
||||
return mix(r, w3, (dist + pixel_size / 2) / pixel_size);
|
||||
}
|
||||
if (P(0xbf,0x8f) || P(0x7e,0x0e)) {
|
||||
if (P(0xBF,0x8F) || P(0x7E,0x0E)) {
|
||||
float dist = p.x + 2.0 * p.y;
|
||||
float pixel_size = length(1.0 / (output_resolution / input_resolution)) * sqrt(5.0);
|
||||
|
||||
@ -150,7 +150,7 @@ STATIC vec4 scale(sampler2D image, vec2 position, vec2 input_resolution, vec2 ou
|
||||
return mix(r, w4, (dist + pixel_size / 2 - 1.0) / pixel_size);
|
||||
}
|
||||
|
||||
if (P(0x7e,0x2a) || P(0xef,0xab)) {
|
||||
if (P(0x7E,0x2A) || P(0xEF,0xAB)) {
|
||||
float dist = p.y + 2.0 * p.x;
|
||||
float pixel_size = length(1.0 / (output_resolution / input_resolution)) * sqrt(5.0);
|
||||
|
||||
@ -174,22 +174,22 @@ STATIC vec4 scale(sampler2D image, vec2 position, vec2 input_resolution, vec2 ou
|
||||
return mix(r, w4, (dist + pixel_size / 2 - 1.0) / pixel_size);
|
||||
}
|
||||
|
||||
if (P(0x1b,0x03) || P(0x4f,0x43) || P(0x8b,0x83) || P(0x6b,0x43)) {
|
||||
if (P(0x1B,0x03) || P(0x4F,0x43) || P(0x8B,0x83) || P(0x6B,0x43)) {
|
||||
return mix(w4, w3, 0.5 - p.x);
|
||||
}
|
||||
|
||||
if (P(0x4b,0x09) || P(0x8b,0x89) || P(0x1f,0x19) || P(0x3b,0x19)) {
|
||||
if (P(0x4B,0x09) || P(0x8B,0x89) || P(0x1F,0x19) || P(0x3B,0x19)) {
|
||||
return mix(w4, w1, 0.5 - p.y);
|
||||
}
|
||||
|
||||
if (P(0xfb,0x6a) || P(0x6f,0x6e) || P(0x3f,0x3e) || P(0xfb,0xfa) ||
|
||||
P(0xdf,0xde) || P(0xdf,0x1e)) {
|
||||
if (P(0xFB,0x6A) || P(0x6F,0x6E) || P(0x3F,0x3E) || P(0xFB,0xFA) ||
|
||||
P(0xDF,0xDE) || P(0xDF,0x1E)) {
|
||||
return mix(w4, w0, (1.0 - p.x - p.y) / 2.0);
|
||||
}
|
||||
|
||||
if (P(0x4f,0x4b) || P(0x9f,0x1b) || P(0x2f,0x0b) ||
|
||||
P(0xbe,0x0a) || P(0xee,0x0a) || P(0x7e,0x0a) || P(0xeb,0x4b) ||
|
||||
P(0x3b,0x1b)) {
|
||||
if (P(0x4F,0x4B) || P(0x9F,0x1B) || P(0x2F,0x0B) ||
|
||||
P(0xBE,0x0A) || P(0xEE,0x0A) || P(0x7E,0x0A) || P(0xEB,0x4B) ||
|
||||
P(0x3B,0x1B)) {
|
||||
float dist = p.x + p.y;
|
||||
float pixel_size = length(1.0 / (output_resolution / input_resolution));
|
||||
|
||||
@ -212,11 +212,11 @@ STATIC vec4 scale(sampler2D image, vec2 position, vec2 input_resolution, vec2 ou
|
||||
return mix(r, w4, (dist + pixel_size / 2 - 0.5) / pixel_size);
|
||||
}
|
||||
|
||||
if (P(0x0b,0x01)) {
|
||||
if (P(0x0B,0x01)) {
|
||||
return mix(mix(w4, w3, 0.5 - p.x), mix(w1, (w1 + w3) / 2.0, 0.5 - p.x), 0.5 - p.y);
|
||||
}
|
||||
|
||||
if (P(0x0b,0x00)) {
|
||||
if (P(0x0B,0x00)) {
|
||||
return mix(mix(w4, w3, 0.5 - p.x), mix(w1, w0, 0.5 - p.x), 0.5 - p.y);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user