finalize Lumacode support

This commit is contained in:
marqs 2026-03-07 23:47:02 +02:00
parent bb4932fc28
commit c7fa9527fa
12 changed files with 230 additions and 83 deletions

View File

@ -153,7 +153,7 @@ typedef struct {
// lumacode palatte ram
typedef struct {
uint32_t data[512];
uint32_t data[256];
} lc_pal_ram;
typedef struct {

View File

@ -191,6 +191,6 @@ set_interface_property lc_ram_if CMSIS_SVD_VARIABLES ""
set_interface_property lc_ram_if SVD_ADDRESS_GROUP ""
add_interface_port lc_ram_if lumacode_clk_i lumacode_clk_i Input 1
add_interface_port lc_ram_if lumacode_addr_i lumacode_addr_i Input 9
add_interface_port lc_ram_if lumacode_addr_i lumacode_addr_i Input 8
add_interface_port lc_ram_if lumacode_rden_i lumacode_rden_i Input 1
add_interface_port lc_ram_if lumacode_data_o lumacode_data_o Output 32

View File

@ -53,7 +53,7 @@ module sc_config_top(
output [10:0] shmask_data,
// Lumacode interface
input lumacode_clk_i,
input [8:0] lumacode_addr_i,
input [7:0] lumacode_addr_i,
input lumacode_rden_i,
output [31:0] lumacode_data_o
);
@ -128,7 +128,7 @@ defparam
// Lumacode palette RAM
altsyncram lumacode_pal_ram (
.address_a (avalon_s_address[8:0]),
.address_a (avalon_s_address[7:0]),
.address_b (lumacode_addr_i),
.clock0 (clk_i),
.clock1 (lumacode_clk_i),
@ -159,15 +159,15 @@ defparam
lumacode_pal_ram.clock_enable_output_b = "BYPASS",
lumacode_pal_ram.intended_device_family = "Cyclone IV E",
lumacode_pal_ram.lpm_type = "altsyncram",
lumacode_pal_ram.numwords_a = 512,
lumacode_pal_ram.numwords_b = 512,
lumacode_pal_ram.numwords_a = 256,
lumacode_pal_ram.numwords_b = 256,
lumacode_pal_ram.operation_mode = "DUAL_PORT",
lumacode_pal_ram.outdata_aclr_b = "NONE",
lumacode_pal_ram.outdata_reg_b = "UNREGISTERED",
lumacode_pal_ram.power_up_uninitialized = "FALSE",
lumacode_pal_ram.rdcontrol_reg_b = "CLOCK1",
lumacode_pal_ram.widthad_a = 9,
lumacode_pal_ram.widthad_b = 9,
lumacode_pal_ram.widthad_a = 8,
lumacode_pal_ram.widthad_b = 8,
lumacode_pal_ram.width_a = 32,
lumacode_pal_ram.width_b = 32,
lumacode_pal_ram.width_byteena_a = 1;

View File

@ -130,7 +130,7 @@ wire lt_trig_waiting;
wire lt_finished;
wire [31:0] lumacode_data;
wire [8:0] lumacode_addr;
wire [7:0] lumacode_addr;
wire lumacode_rden;
reg remote_event_prev;

View File

@ -54,7 +54,7 @@ module tvp7002_frontend (
output reg [19:0] pcnt_field,
output reg [7:0] hsync_width,
output reg sync_active,
output [8:0] lumacode_addr,
output [7:0] lumacode_addr,
output lumacode_rden
);
@ -65,10 +65,10 @@ localparam VSYNC_SEPARATED = 1'b0;
localparam VSYNC_RAW = 1'b1;
localparam LC_DISABLED = 3'd0;
localparam LC_C64 = 3'd1;
localparam LC_SPECTRUM = 3'd2;
localparam LC_MSX = 3'd3;
localparam LC_INTV = 3'd4;
localparam LC_2S = 3'd1;
localparam LC_2S2X = 3'd2;
localparam LC_3S = 3'd3;
localparam LC_4S = 3'd4;
localparam LC_NES = 3'd5;
localparam LC_GTIA = 3'd6;
localparam LC_CTIA = 3'd7;
@ -180,9 +180,10 @@ endfunction
// Lumacode number of samples selection
always @(*) begin
case(MISC_LUMACODE_MODE)
LC_C64,LC_SPECTRUM,LC_MSX,LC_CTIA : LC_SAMPLES = 2; // 2 samples for {C64, C128, VIC20, Spectrum, TMS99xxA} / 4 samples for VCS (2 per half-pixel)
LC_INTV : LC_SAMPLES = 1; // 2 samples for Intellivision (1 per doubled pixel)
LC_NES,LC_GTIA : LC_SAMPLES = 3; // 3 samples for NES / 6 samples for Atari 8bit (3 per pixel)
LC_2S,LC_CTIA : LC_SAMPLES = 2; // 2 samples for {C64, C128, Spectrum, TMS99xxA} / 4 samples for VCS (2 per half-pixel)
LC_2S2X : LC_SAMPLES = 1; // 2 samples for VIC20, Intellivision, G7000 (1 per doubled pixel)
LC_3S,LC_NES,LC_GTIA : LC_SAMPLES = 3; // 3 samples for {NES, SMS} / 6 samples for Atari 8bit (3 per pixel)
LC_4S : LC_SAMPLES = 4; // 4 samples for Atari 7800
default : LC_SAMPLES = 1;
endcase
end
@ -285,8 +286,8 @@ always @(posedge PCLK_i) begin
if (MISC_LUMACODE_MODE == LC_NES) begin
if ((h_ctr == H_SAMPLE_SEL) & ({lc_code[1], lc_code[2], lc_code[3]} < 8))
lc_emp_nes <= {lc_code[2][0], lc_code[3]};
// Lumacode Intellivision
end else if (MISC_LUMACODE_MODE == LC_INTV) begin
// Lumacode 2 samples (1 per doubled pixel)
end else if (MISC_LUMACODE_MODE == LC_2S2X) begin
if ((h_ctr == H_SAMPLE_SEL) & lc_atari_ctr) begin
lc_atari_luma[1:0] <= lc_code[1];
end
@ -305,7 +306,7 @@ always @(posedge PCLK_i) begin
end
end
// Lumacode Atari VCS
end else begin
end else if (MISC_LUMACODE_MODE == LC_CTIA) begin
if (h_ctr == H_SAMPLE_SEL) begin
if (lc_atari_ctr) begin
// Store first 2 lumacode samples (hue) from double-sampled input (160col->320col)
@ -392,32 +393,28 @@ end
// Lumacode palette RAM inputs
always @(*)
case (MISC_LUMACODE_MODE)
LC_C64: begin // C64, C128, VIC20
lumacode_addr = {5'h0, lc_code[1], lc_code[2]};
LC_2S: begin // C64, C128, Spectrum, TMS99xxA
lumacode_addr = {4'h0, lc_code[1], lc_code[2]};
lumacode_rden = 1;
end
LC_SPECTRUM: begin // Spectrum
lumacode_addr = {5'h1, lc_code[1], lc_code[2]};
lumacode_rden = 1;
end
LC_MSX: begin // TMS99xxA
lumacode_addr = {5'h2, lc_code[1], lc_code[2]};
lumacode_rden = 1;
end
LC_INTV: begin // Intellivision
lumacode_addr = {5'h3, lc_atari_luma[1:0], lc_code[1]};
LC_2S2X: begin // VIC20, Intellivision, G7000
lumacode_addr = {4'h0, lc_atari_luma[1:0], lc_code[1]};
lumacode_rden = (h_ctr == H_SAMPLE_SEL) & !lc_atari_ctr;
end
LC_NES: begin // NES
lumacode_addr = {3'h1, lc_code[1], lc_code[2], lc_code[3]};
LC_3S,LC_NES: begin // SMS, NES
lumacode_addr = {2'h0, lc_code[1], lc_code[2], lc_code[3]};
lumacode_rden = 1;
end
LC_4S: begin // Atari 7800
lumacode_addr = {lc_code[1], lc_code[2], lc_code[3], lc_code[4]};
lumacode_rden = 1;
end
LC_GTIA: begin // Atari GTIA
lumacode_addr = lc_atari_ctr ? {1'h1, lc_atari_hue, lc_atari_luma} : {1'h1, lc_atari_hue, lc_atari_luma[3:2], lc_code[1]};
lumacode_addr = lc_atari_ctr ? {lc_atari_hue, lc_atari_luma} : {lc_atari_hue, lc_atari_luma[3:2], lc_code[1]};
lumacode_rden = (h_ctr == H_SAMPLE_SEL);
end
LC_CTIA: begin // Atari CTIA/TIA
lumacode_addr = {2'h1, lc_atari_hue, lc_code[1], lc_code[2][1]};
lumacode_addr = {1'h0, lc_atari_hue, lc_code[1], lc_code[2][1]};
lumacode_rden = (h_ctr == H_SAMPLE_SEL) & !lc_atari_ctr;
end
default: begin // Standard output

View File

@ -144,7 +144,7 @@ int shmask_loaded_str = -1;
#define SHMASKS_SIZE (sizeof(shmask_data_arr_list) / sizeof((shmask_data_arr_list)[0]))
c_lc_palette_set_t c_lc_palette_set;
const lc_palette_set* lc_palette_set_list[] = {&lc_palette_pal, &c_lc_palette_set.pal};
const lc_palette_set* lc_palette_set_list[] = {&lc_palette_pal, &lc_palette_ntsc, &c_lc_palette_set.pal};
int loaded_lc_palette = -1;
void ui_disp_menu(alt_u8 osd_mode)
@ -466,6 +466,19 @@ void update_sc_config()
{
int i, p, t;
shmask_data_arr *shmask_data_arr_ptr;
struct {uint32_t offset; uint32_t size; uint8_t mode;} lc_cfg_arr[] = {{0, 0, 0},
{offsetof(lc_palette_set, vic20_pal), sizeof(lc_palette_pal.vic20_pal), 2},
{offsetof(lc_palette_set, c64_pal), sizeof(lc_palette_pal.c64_pal), 1},
{offsetof(lc_palette_set, zx_pal), sizeof(lc_palette_pal.zx_pal), 1},
{offsetof(lc_palette_set, msx_pal), sizeof(lc_palette_pal.msx_pal), 1},
{offsetof(lc_palette_set, intv_pal), sizeof(lc_palette_pal.intv_pal), 2},
{offsetof(lc_palette_set, g7000_pal), sizeof(lc_palette_pal.g7000_pal), 2},
{offsetof(lc_palette_set, mc6847_pal), sizeof(lc_palette_pal.mc6847_pal), 1},
{offsetof(lc_palette_set, sms_pal), sizeof(lc_palette_pal.sms_pal), 3},
{offsetof(lc_palette_set, nes_pal), sizeof(lc_palette_pal.nes_pal), 5},
{offsetof(lc_palette_set, gtia_pal), sizeof(lc_palette_pal.gtia_pal), 6},
{offsetof(lc_palette_set, tia_pal), sizeof(lc_palette_pal.tia_pal), 7},
{offsetof(lc_palette_set, maria_pal), sizeof(lc_palette_pal.maria_pal), 4}};
mode_data_t *vm_in = &vmode_in;
mode_data_t *vm_out = &vmode_out;
@ -500,10 +513,10 @@ void update_sc_config()
shmask_data_arr_ptr = shmask_loaded_array ? (shmask_data_arr*)shmask_data_arr_list[shmask_loaded_array] : (shmask_data_arr*)shmask_data_arr_list[1];
}
if (avconfig->lumacode_mode && (avconfig->lumacode_pal != loaded_lc_palette)) {
for (i=0; i<(sizeof(lc_palette_set)/4); i++)
sc->lumacode_pal_ram.data[i] = lc_palette_set_list[avconfig->lumacode_pal]->data[i];
loaded_lc_palette = avconfig->lumacode_pal;
if (avconfig->lumacode_mode && ((avconfig->lumacode_pal*100)+avconfig->lumacode_mode != loaded_lc_palette)) {
for (i=0; i<lc_cfg_arr[avconfig->lumacode_mode].size/4; i++)
sc->lumacode_pal_ram.data[i] = lc_palette_set_list[avconfig->lumacode_pal]->data[(lc_cfg_arr[avconfig->lumacode_mode].offset/4)+i];
loaded_lc_palette = (avconfig->lumacode_pal*100)+avconfig->lumacode_mode;
}
// Set input params
@ -546,7 +559,7 @@ void update_sc_config()
misc_config.shmask_enable = (avconfig->shmask_mode != 0);
misc_config.shmask_iv_x = shmask_data_arr_ptr->iv_x;
misc_config.shmask_iv_y = shmask_data_arr_ptr->iv_y;
misc_config.lumacode_mode = avconfig->lumacode_mode;
misc_config.lumacode_mode = lc_cfg_arr[avconfig->lumacode_mode].mode;
misc_config.panasonic_hack = avconfig->panasonic_hack;
/*misc_config.lm_deint_mode = 0;
misc_config.nir_even_offset = 0;*/
@ -1051,7 +1064,7 @@ int main()
printf("### DIY VIDEO DIGITIZER / SCANCONVERTER INIT OK ###\n\n");
sniprintf(row1, LCD_ROW_LEN+1, " OSSC fw. %u.%.2u" FW_SUFFIX, FW_VER_MAJOR, FW_VER_MINOR);
#ifndef DEBUG
strncpy(row2, "2014-2025 marqs", LCD_ROW_LEN+1);
strncpy(row2, "2014-2026 marqs", LCD_ROW_LEN+1);
#else
strncpy(row2, "** DEBUG BUILD *", LCD_ROW_LEN+1);
#endif

View File

@ -123,8 +123,13 @@ typedef union {
uint32_t nes_pal[64];
uint32_t tia_pal[128];
uint32_t gtia_pal[256];
uint32_t maria_pal[256];
uint32_t sms_pal[64];
uint32_t vic20_pal[16];
uint32_t g7000_pal[16];
uint32_t mc6847_pal[16];
} __attribute__((packed, __may_alias__));
uint32_t data[512];
uint32_t data[880];
} lc_palette_set;
typedef struct {

View File

@ -24,7 +24,7 @@
#include "sysconfig.h"
#define FW_VER_MAJOR 1
#define FW_VER_MINOR 20
#define FW_VER_MINOR 21
#ifdef OSDLANG_JP
#define FW_SUFFIX "j"

View File

@ -87,19 +87,20 @@ typedef struct {
typedef struct {
func_call f;
const arg_info_t *arg_info;
const arg_info_t *arg_info; // must be at 4byte offset
} opt_func_call;
typedef struct menustruct menu_t;
typedef struct {
const menu_t *menu;
const arg_info_t *arg_info;
const arg_info_t *arg_info; // must be at 4byte offset
arg_func arg_f;
} opt_submenu;
typedef struct {
cstm_disp_func cstm_f;
const arg_info_t *arg_info; // must be at 4byte offset
} opt_custommenu;
typedef struct {

View File

@ -3,11 +3,67 @@
const lc_palette_set lc_palette_pal = {.c64_pal={0x000000,0x2a1b9d,0x7d202c,0x84258c,0x4c2e00,0x3c3c3c,0x646464,0x4fb3a5,0x7f410d,0x6351db,0x939393,0xbfd04a,0x339840,0xb44f5c,0x7ce587,0xffffff},
.zx_pal= {0x000000,0x000000,0x0200FD,0xCF01CE,0x0100CE,0xCF0100,0xFF02FD,0x01CFCF,0xFF0201,0x00CF15,0x02FFFF,0xFFFF1D,0x00FF1C,0xCFCF15,0xCFCFCF,0xFFFFFF},
.msx_pal={0x000000,0x5455ed,0xfc5554,0xff7978,0x000000,0xd4524d,0x7d76fc,0x42ebf5,0x21b03b,0x21c842,0xff7978,0xcccccc,0xc95bba,0xd4c154,0xe6ce80,0xffffff},
.intv_pal={0x0c0005,0xa7a8a8,0xfffcff,0xff3e00,0xffa600,0xfaea27,0x00780f,0x00a720,0x6ccd30,0x002dff,0x5acbff,0xbd95ff,0xc81a7d,0xff3276,0x3c5800,0xc9d464},
.nes_pal={0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x626262,0x001fb2,0x2404c8,0x5200b2,0x730076,0x800024,0x730b00,0x522800,
0x244400,0x005700,0x005c00,0x005324,0x003c76,0x000000,0xababab,0x0d57ff,0x4b30ff,0x8a13ff,0xbc08d6,0xd21269,0xc72e00,0x9d5400,0x607b00,0x209800,
0x00a300,0x009942,0x007db4,0x000000,0xffffff,0x53aeff,0x9085ff,0xd365ff,0xff57ff,0xff5dcf,0xff7757,0xfa9e00,0xbdc700,0x7ae700,0x43f611,0x26ef7e,
0x2cd5f6,0x4e4e4e,0xffffff,0xb6e1ff,0xced1ff,0xe9c3ff,0xffbcff,0xffbdf4,0xffc6c3,0xffd59a,0xe9e681,0xcef481,0xb6fb9a,0xa9fac3,0xa9f0f4,0xb8b8b8},
.intv_pal={0x000000,0x002dff,0xff3e00,0xc9d464,0x00780f,0x00a720,0xfaea27,0xfffcff,0xa7a8a8,0x5acbff,0xffa600,0x3c5800,0xff3276,0xbd95ff,0x6ccd30,0xc81a7d},
.nes_pal={0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x626262,0x002263,0x0D107D,0x2B027D,0x440063,0x530036,0x530502,0x441500,
0x2B2700,0x0D3600,0x003E00,0x003D02,0x003336,0x000000,0xABABAB,0x1251A8,0x3438CB,0x5C24CB,0x7E19A8,0x921B6B,0x922924,0x7E3F00,0x5C5700,0x346B00,
0x127600,0x007424,0x00676B,0x000000,0xFFFFFF,0x62A1FA,0x8589FF,0xAC75FF,0xCF6AFA,0xE36CBC,0xE37975,0xCF9037,0xACA814,0x85BC14,0x62C737,0x4EC575,
0x4EB7BC,0x4E4E4E,0xFFFFFF,0xC4DDFF,0xD1D3FF,0xE1CBFF,0xEFC7FF,0xF6C8E7,0xF6CDCB,0xEFD6B3,0xE1DFA6,0xD1E7A6,0xC4EBB3,0xBCEBCB,0xBCE5E7,0xB8B8B8},
.tia_pal={0x000000,0x282828,0x505050,0x747474,0x949494,0xb4b4b4,0xd0d0d0,0xececec,0x000000,0x282828,0x505050,0x747474,0x949494,0xb4b4b4,0xd0d0d0,0xececec,
0x805800,0x947020,0xa8843c,0xbc9c58,0xccac70,0xdcc084,0xecd09c,0xfce0b0,0x445c00,0x5c7820,0x74903c,0x8cac58,0xa0c070,0xb0d484,0xc4e89c,0xd4fcb0,
0x703400,0x885020,0xa0683c,0xb48458,0xc89870,0xdcac84,0xecc09c,0xfcd4b0,0x006414,0x208034,0x3c9850,0x58b06c,0x70c484,0x84d89c,0x9ce8b4,0xb0fcc8,
0x700014,0x882034,0xa03c50,0xb4586c,0xc87084,0xdc849c,0xec9cb4,0xfcb0c8,0x005c5c,0x207474,0x3c8c8c,0x58a4a4,0x70b8b8,0x84c8c8,0x9cdcdc,0xb0ecec,
0x70005c,0x842074,0x943c88,0xa8589c,0xb470b0,0xc484c0,0xd09cd0,0xe0b0e0,0x003c70,0x1c5888,0x3874a0,0x508cb4,0x68a4c8,0x7cb8dc,0x90ccec,0xa4e0fc,
0x580070,0x6c2088,0x803ca0,0x9458b4,0xa470c8,0xb484dc,0xc49cec,0xd4b0fc,0x002070,0x1c3c88,0x3858a0,0x5074b4,0x6888c8,0x7ca0dc,0x90b4ec,0xa4c8fc,
0x3c0080,0x542094,0x6c3ca8,0x8058bc,0x9470cc,0xa884dc,0xb89cec,0xc8b0fc,0x000088,0x20209c,0x3c3cb0,0x5858c0,0x7070d0,0x8484e0,0x9c9cec,0xb0b0fc,
0x000000,0x282828,0x505050,0x747474,0x949494,0xb4b4b4,0xd0d0d0,0xececec,0x000000,0x282828,0x505050,0x747474,0x949494,0xb4b4b4,0xd0d0d0,0xececec},
.gtia_pal={0x000000,0x111111,0x222222,0x333333,0x444444,0x555555,0x666666,0x777777,0x888888,0x999999,0xaaaaaa,0xbbbbbb,0xcccccc,0xdddddd,0xeeeeee,0xffffff,
0x091900,0x192806,0x29370d,0x3a4714,0x4a561b,0x5a6522,0x6b7529,0x7b8430,0x8c9336,0x9ca33d,0xacb244,0xbdc14b,0xcdd152,0xdee059,0xeeef60,0xffff67,
0x300000,0x3d1108,0x4b2211,0x593319,0x674422,0x75552a,0x826633,0x90773b,0x9e8844,0xac994c,0xbaaa55,0xc7bb5d,0xd5cc66,0xe3dd6e,0xf1ee77,0xffff80,
0x4b0000,0x570f0c,0x631e18,0x6f2e24,0x7a3d30,0x874d3c,0x935c49,0x9f6b55,0xab7b61,0xb68a6d,0xc39a79,0xcfa986,0xdbb892,0xe6c89e,0xf3d7aa,0xffe7b7,
0x550000,0x600e10,0x6b1c21,0x772a32,0x823843,0x8d4654,0x995465,0xa46276,0xaf7187,0xbb7f98,0xc68da9,0xd19bba,0xdda9cb,0xe8b7dc,0xf3c5ed,0xffd4fe,
0x4c0047,0x570d53,0x631b5f,0x6f286b,0x7b3678,0x874384,0x935190,0x9f5e9c,0xab6ca9,0xb779b5,0xc387c1,0xcf94cd,0xdba2da,0xe7afe6,0xf3bdf2,0xffcbff,
0x30007e,0x3b0b85,0x49198d,0x572796,0x65349f,0x7242a7,0x8050b0,0x8e5db8,0x9c6bc1,0xa979c9,0xb786d2,0xc594db,0xd3a2e3,0xe0afec,0xeebdf4,0xfccbfd,
0x0a0097,0x1a0e9d,0x2a1da4,0x3b2cab,0x4b3ab2,0x5b49b9,0x6c58c0,0x7c67c7,0x8c75ce,0x9c84d5,0xad93dc,0xbda2e3,0xceb0ea,0xdebff1,0xeecef8,0xffddff,
0x00008e,0x0c0d94,0x1b1e9c,0x2a2ea3,0x393eab,0x484eb2,0x575eba,0x666ec1,0x747ec9,0x838fd0,0x929fd8,0xa1afdf,0xb0bfe6,0xbfcfee,0xcedff5,0xddeffd,
0x000e64,0x0c1e6e,0x192e78,0x263e83,0x324e8d,0x3f5e97,0x4c6ea2,0x587eac,0x658eb6,0x729ec1,0x7eaecb,0x8bbed5,0x98cee0,0xa4deea,0xb1eef4,0xbeffff,
0x002422,0x09302e,0x153f3d,0x204d4c,0x2c5c5a,0x376a69,0x427978,0x4e8786,0x599695,0x65a4a4,0x70b3b2,0x7cc1c1,0x87d0d0,0x92dfde,0x9eeded,0xa9fcfc,
0x003200,0x0b3f0e,0x164d1c,0x225b2b,0x2d6839,0x397648,0x448456,0x509164,0x5b9f73,0x67ad81,0x72ba90,0x7ec89e,0x89d6ac,0x95e3bb,0xa0f1c9,0xacffd8,
0x003400,0x0c410a,0x194f14,0x265c1e,0x336a28,0x407732,0x4c853c,0x599246,0x66a050,0x73ad5a,0x80bb64,0x8cc86e,0x99d678,0xa6e382,0xb3f18c,0xc0ff97,
0x002a00,0x0f3807,0x1e460e,0x2d5416,0x3c621d,0x4b7124,0x5a7f2c,0x698d33,0x799b3b,0x88a942,0x97b849,0xa6c651,0xb5d458,0xc4e260,0xd3f067,0xe3ff6f,
0x0d1700,0x1d2606,0x2d350d,0x3d4514,0x4d541b,0x5d6422,0x6d7329,0x7d8330,0x8e9237,0x9ea23e,0xaeb145,0xbec14c,0xced053,0xdee05a,0xeeef61,0xffff68,
0x330000,0x401008,0x4e2111,0x5b321a,0x694323,0x77542c,0x846535,0x92763e,0x9f8646,0xad974f,0xbba858,0xc8b961,0xd6ca6a,0xe3db73,0xf1ec7c,0xfffd85},
.maria_pal={0x000000,0x111111,0x222222,0x333333,0x444444,0x555555,0x666666,0x777777,0x888888,0x999999,0xaaaaaa,0xbbbbbb,0xcccccc,0xdddddd,0xeeeeee,0xffffff,
0x001707,0x0e2808,0x1f3908,0x304a08,0x415b08,0x526c08,0x637d08,0x748e0d,0x859f1e,0x96b02f,0xa7c140,0xb8d251,0xc9e362,0xdaf473,0xebff82,0xfcff8e,
0x1a0700,0x2b1800,0x3c2900,0x4d3a00,0x5e4b00,0x6f5c00,0x806d00,0x917e09,0xa28f1a,0xb3a02b,0xc4b13c,0xd5c24d,0xe6d35e,0xf7e46f,0xfff583,0xfff797,
0x310000,0x420600,0x531700,0x642800,0x753900,0x864a00,0x975b0a,0xa86c1b,0xb97d2c,0xca8e3d,0xdb9f4e,0xecb05f,0xfdc170,0xffd285,0xffe39c,0xfff4b2,
0x3e0000,0x4f0000,0x600800,0x711900,0x822a0d,0x933b1e,0xa44c2f,0xb55d40,0xc66e51,0xd77f62,0xe89073,0xf9a183,0xffb298,0xffc3ae,0xffd4c4,0xffe5da,
0x3f0003,0x50000f,0x61001b,0x720f2b,0x83203c,0x94314d,0xa5425e,0xb6536f,0xc76480,0xd87591,0xe986a2,0xfa97b3,0xffa8c8,0xffb9de,0xffcaef,0xffdbf4,
0x330035,0x440041,0x55004c,0x660c5c,0x771d6d,0x882e7e,0x993f8f,0xaa50a0,0xbb61b1,0xcc72c2,0xdd83d3,0xee94e4,0xffa5e4,0xffb6e9,0xffc7ee,0xffd8f3,
0x1d005c,0x2e0068,0x400074,0x511084,0x622195,0x7332a6,0x8443b7,0x9554c8,0xa665d9,0xb776ea,0xc887eb,0xd998eb,0xe9a9ec,0xfbbaeb,0xffcbef,0xffdcf4,
0x020071,0x13007d,0x240b8c,0x351c9d,0x462dae,0x573ebf,0x684fd0,0x7960e1,0x8a71f2,0x9b82f7,0xac93f7,0xbda4f7,0xceb5f7,0xdfc6f7,0xf0d7f7,0xffe8f8,
0x000068,0x000a7c,0x081b90,0x192ca1,0x2a3db2,0x3b4ec3,0x4c5fd4,0x5d70e5,0x6e81f6,0x7f92ff,0x90a3ff,0xa1b4ff,0xb2c5ff,0xc3d6ff,0xd4e7ff,0xe5f8ff,
0x000a4d,0x001b63,0x002c79,0x023d8f,0x134ea0,0x245fb1,0x3570c2,0x4681d3,0x5792e4,0x68a3f5,0x79b4ff,0x8ac5ff,0x9bd6ff,0xace7ff,0xbdf8ff,0xceffff,
0x001a26,0x002b3c,0x003c52,0x004d68,0x065e7c,0x176f8d,0x28809e,0x3991af,0x4aa2c0,0x5bb3d1,0x6cc4e2,0x7dd5f3,0x8ee6ff,0x9ff7ff,0xb0ffff,0xc1ffff,
0x00240b,0x003510,0x004622,0x005738,0x05684d,0x16795e,0x278a6f,0x389b80,0x49ac91,0x5abda2,0x6bceb3,0x7cdfc4,0x8df0d5,0x9effe5,0xaffff1,0xc0fffd,
0x00270c,0x003811,0x004916,0x005a1b,0x106b1b,0x217c2c,0x328d3d,0x439e4e,0x54af5f,0x65c070,0x76d181,0x87e292,0x98f3a3,0xa9ffb3,0xbaffbf,0xcbffcb,
0x00230a,0x003410,0x044513,0x155613,0x266713,0x377813,0x488914,0x599a25,0x6aab36,0x7bbc47,0x8ccd58,0x9dde69,0xaeef7a,0xbfff8b,0xd0ff97,0xe1ffa3,
0x001707,0x0e2808,0x1f3908,0x304a08,0x415b08,0x526c08,0x637d08,0x748e0d,0x859f1e,0x96b02f,0xa7c140,0xb8d251,0xc9e362,0xdaf473,0xebff82,0xfcff8e},
.sms_pal={0x000000,0x000054,0x0000a8,0x0000ff,0x005400,0x005454,0x0054a8,0x0054ff,0x00a800,0x00a854,0x00a8a8,0x00a8ff,0x00ff00,0x00ff54,0x00ffa8,0x00ffff,
0x540000,0x540054,0x5400a8,0x5400ff,0x545400,0x545454,0x5454a8,0x5454ff,0x54a800,0x54a854,0x54a8a8,0x54a8ff,0x54ff00,0x54ff54,0x54ffa8,0x54ffff,
0xa80000,0xa80054,0xa800a8,0xa800ff,0xa85400,0xa85454,0xa854a8,0xa854ff,0xa8a800,0xa8a854,0xa8a8a8,0xa8a8ff,0xa8ff00,0xa8ff54,0xa8ffa8,0xa8ffff,
0xff0000,0xff0054,0xff00a8,0xff00ff,0xff5400,0xff5454,0xff54a8,0xff54ff,0xffa800,0xffa854,0xffa8a8,0xffa8ff,0xffff00,0xffff54,0xffffa8,0xffffff},
.vic20_pal={0x000000,0x0000f0,0xf00000,0x600060,0xffa000,0x00ffff,0xff00ff,0x00f0f0,0xc0a000,0x00a0ff,0xffff00,0xd0d000,0x00a000,0xf08080,0x00ff00,0xffffff},
.g7000_pal={0x000000,0x0000b6,0x00b600,0x00b6b6,0xb60000,0xb600b6,0xb6b600,0xb6b6b6,0x494949,0x4949ff,0x49ff49,0x49ffff,0xff4949,0xff49ff,0xffff49,0xffffff},
.mc6847_pal={0x000000,0x000000,0x9A3236,0xFFB700,0x6B2700,0x0D3A06,0x4C3AB4,0xBFC8AD,0xD47F00,0xC84EF0,0x41AF71,0x000000,0x30D200,0xC1E500,0x000000,0x000000}};
const lc_palette_set lc_palette_ntsc = {.c64_pal={0x000000,0x2a1b9d,0x7d202c,0x84258c,0x4c2e00,0x3c3c3c,0x646464,0x4fb3a5,0x7f410d,0x6351db,0x939393,0xbfd04a,0x339840,0xb44f5c,0x7ce587,0xffffff},
.zx_pal= {0x000000,0x000000,0x0200FD,0xCF01CE,0x0100CE,0xCF0100,0xFF02FD,0x01CFCF,0xFF0201,0x00CF15,0x02FFFF,0xFFFF1D,0x00FF1C,0xCFCF15,0xCFCFCF,0xFFFFFF},
.msx_pal={0x000000,0x5455ed,0xfc5554,0xff7978,0x000000,0xd4524d,0x7d76fc,0x42ebf5,0x21b03b,0x21c842,0xff7978,0xcccccc,0xc95bba,0xd4c154,0xe6ce80,0xffffff},
.intv_pal={0x000000,0x002dff,0xff3e00,0xc9d464,0x00780f,0x00a720,0xfaea27,0xfffcff,0xa7a8a8,0x5acbff,0xffa600,0x3c5800,0xff3276,0xbd95ff,0x6ccd30,0xc81a7d},
.nes_pal={0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x626262,0x001C95,0x1904AC,0x42009D,0x61006B,0x6E0025,0x650500,0x491E00,
0x223700,0x004900,0x004F00,0x004816,0x00355E,0x000000,0xABABAB,0x0C4EDB,0x3D2EFF,0x7115F3,0x9B0BB9,0xB01262,0xA92704,0x894600,0x576600,0x237F00,
0x008900,0x008332,0x006D90,0x000000,0xFFFFFF,0x57A5FF,0x8287FF,0xB46DFF,0xDF60FF,0xF863C6,0xF8746D,0xDE9020,0xB3AE00,0x81C800,0x56D522,0x3DD36F,
0x3EC1C8,0x4E4E4E,0xFFFFFF,0xBEE0FF,0xCDD4FF,0xE0CAFF,0xF1C4FF,0xFCC4EF,0xFDCACE,0xF5D4AF,0xE6DF9C,0xD3E99A,0xC2EFA8,0xB7EFC4,0xB6EAE5,0xB8B8B8},
.tia_pal={0x000000,0x404040,0x6C6C6C,0x909090,0xB0B0B0,0xC8C8C8,0xDCDCDC,0xECECEC,0x444400,0x646410,0x848424,0xA0A034,0xB8B840,0xD0D050,0xE8E85C,0xFCFC68,
0x702800,0x844414,0x985C28,0xAC783C,0xBC8C4C,0xCCA05C,0xDCB468,0xECC878,0x841800,0x983418,0xAC5030,0xC06848,0xD0805C,0xE09470,0xECA880,0xFCBC94,
0x880000,0x9C2020,0xB03C3C,0xC05858,0xD07070,0xE08888,0xECA0A0,0xFCB4B4,0x78005C,0x8C2074,0xA03C88,0xB0589C,0xC070B0,0xD084C0,0xDC9CD0,0xECB0E0,
@ -31,4 +87,27 @@ const lc_palette_set lc_palette_pal = {.c64_pal={0x000000,0x2a1b9d,0x7d202c,0x84
0x003400,0x0c410a,0x194f14,0x265c1e,0x336a28,0x407732,0x4c853c,0x599246,0x66a050,0x73ad5a,0x80bb64,0x8cc86e,0x99d678,0xa6e382,0xb3f18c,0xc0ff97,
0x002a00,0x0f3807,0x1e460e,0x2d5416,0x3c621d,0x4b7124,0x5a7f2c,0x698d33,0x799b3b,0x88a942,0x97b849,0xa6c651,0xb5d458,0xc4e260,0xd3f067,0xe3ff6f,
0x0d1700,0x1d2606,0x2d350d,0x3d4514,0x4d541b,0x5d6422,0x6d7329,0x7d8330,0x8e9237,0x9ea23e,0xaeb145,0xbec14c,0xced053,0xdee05a,0xeeef61,0xffff68,
0x330000,0x401008,0x4e2111,0x5b321a,0x694323,0x77542c,0x846535,0x92763e,0x9f8646,0xad974f,0xbba858,0xc8b961,0xd6ca6a,0xe3db73,0xf1ec7c,0xfffd85}};
0x330000,0x401008,0x4e2111,0x5b321a,0x694323,0x77542c,0x846535,0x92763e,0x9f8646,0xad974f,0xbba858,0xc8b961,0xd6ca6a,0xe3db73,0xf1ec7c,0xfffd85},
.maria_pal={0x000000,0x111111,0x222222,0x333333,0x444444,0x555555,0x666666,0x777777,0x888888,0x999999,0xaaaaaa,0xbbbbbb,0xcccccc,0xdddddd,0xeeeeee,0xffffff,
0x1a0700,0x2b1800,0x3c2900,0x4d3a00,0x5e4b00,0x6f5c00,0x806d00,0x917e09,0xa28f1a,0xb3a02b,0xc4b13c,0xd5c24d,0xe6d35e,0xf7e46f,0xfff583,0xfff797,
0x310000,0x420600,0x531700,0x642800,0x753900,0x864a00,0x975b0a,0xa86c1b,0xb97d2c,0xca8e3d,0xdb9f4e,0xecb05f,0xfdc170,0xffd285,0xffe39c,0xfff4b2,
0x3e0000,0x4f0000,0x600800,0x711900,0x822a0d,0x933b1e,0xa44c2f,0xb55d40,0xc66e51,0xd77f62,0xe89073,0xf9a183,0xffb298,0xffc3ae,0xffd4c4,0xffe5da,
0x3f0003,0x50000f,0x61001b,0x720f2b,0x83203c,0x94314d,0xa5425e,0xb6536f,0xc76480,0xd87591,0xe986a2,0xfa97b3,0xffa8c8,0xffb9de,0xffcaef,0xffdbf4,
0x330035,0x440041,0x55004c,0x660c5c,0x771d6d,0x882e7e,0x993f8f,0xaa50a0,0xbb61b1,0xcc72c2,0xdd83d3,0xee94e4,0xffa5e4,0xffb6e9,0xffc7ee,0xffd8f3,
0x1d005c,0x2e0068,0x400074,0x511084,0x622195,0x7332a6,0x8443b7,0x9554c8,0xa665d9,0xb776ea,0xc887eb,0xd998eb,0xe9a9ec,0xfbbaeb,0xffcbef,0xffdcf4,
0x020071,0x13007d,0x240b8c,0x351c9d,0x462dae,0x573ebf,0x684fd0,0x7960e1,0x8a71f2,0x9b82f7,0xac93f7,0xbda4f7,0xceb5f7,0xdfc6f7,0xf0d7f7,0xffe8f8,
0x000068,0x000a7c,0x081b90,0x192ca1,0x2a3db2,0x3b4ec3,0x4c5fd4,0x5d70e5,0x6e81f6,0x7f92ff,0x90a3ff,0xa1b4ff,0xb2c5ff,0xc3d6ff,0xd4e7ff,0xe5f8ff,
0x000a4d,0x001b63,0x002c79,0x023d8f,0x134ea0,0x245fb1,0x3570c2,0x4681d3,0x5792e4,0x68a3f5,0x79b4ff,0x8ac5ff,0x9bd6ff,0xace7ff,0xbdf8ff,0xceffff,
0x001a26,0x002b3c,0x003c52,0x004d68,0x065e7c,0x176f8d,0x28809e,0x3991af,0x4aa2c0,0x5bb3d1,0x6cc4e2,0x7dd5f3,0x8ee6ff,0x9ff7ff,0xb0ffff,0xc1ffff,
0x00240b,0x003510,0x004622,0x005738,0x05684d,0x16795e,0x278a6f,0x389b80,0x49ac91,0x5abda2,0x6bceb3,0x7cdfc4,0x8df0d5,0x9effe5,0xaffff1,0xc0fffd,
0x00270c,0x003811,0x004916,0x005a1b,0x106b1b,0x217c2c,0x328d3d,0x439e4e,0x54af5f,0x65c070,0x76d181,0x87e292,0x98f3a3,0xa9ffb3,0xbaffbf,0xcbffcb,
0x00230a,0x003410,0x044513,0x155613,0x266713,0x377813,0x488914,0x599a25,0x6aab36,0x7bbc47,0x8ccd58,0x9dde69,0xaeef7a,0xbfff8b,0xd0ff97,0xe1ffa3,
0x001707,0x0e2808,0x1f3908,0x304a08,0x415b08,0x526c08,0x637d08,0x748e0d,0x859f1e,0x96b02f,0xa7c140,0xb8d251,0xc9e362,0xdaf473,0xebff82,0xfcff8e,
0x190700,0x2a1800,0x3b2900,0x4c3a00,0x5d4b00,0x6e5c00,0x7f6d00,0x907e09,0xa18f1a,0xb2a02b,0xc3b13c,0xd4c24d,0xe5d35e,0xf6e46f,0xfff582,0xffff96},
.sms_pal={0x000000,0x000054,0x0000a8,0x0000ff,0x005400,0x005454,0x0054a8,0x0054ff,0x00a800,0x00a854,0x00a8a8,0x00a8ff,0x00ff00,0x00ff54,0x00ffa8,0x00ffff,
0x540000,0x540054,0x5400a8,0x5400ff,0x545400,0x545454,0x5454a8,0x5454ff,0x54a800,0x54a854,0x54a8a8,0x54a8ff,0x54ff00,0x54ff54,0x54ffa8,0x54ffff,
0xa80000,0xa80054,0xa800a8,0xa800ff,0xa85400,0xa85454,0xa854a8,0xa854ff,0xa8a800,0xa8a854,0xa8a8a8,0xa8a8ff,0xa8ff00,0xa8ff54,0xa8ffa8,0xa8ffff,
0xff0000,0xff0054,0xff00a8,0xff00ff,0xff5400,0xff5454,0xff54a8,0xff54ff,0xffa800,0xffa854,0xffa8a8,0xffa8ff,0xffff00,0xffff54,0xffffa8,0xffffff},
.vic20_pal={0x000000,0x0000f0,0xf00000,0x600060,0xffa000,0x00ffff,0xff00ff,0x00f0f0,0xc0a000,0x00a0ff,0xffff00,0xd0d000,0x00a000,0xf08080,0x00ff00,0xffffff},
.g7000_pal={0x000000,0x0000b6,0x00b600,0x00b6b6,0xb60000,0xb600b6,0xb6b600,0xb6b6b6,0x494949,0x4949ff,0x49ff49,0x49ffff,0xff4949,0xff49ff,0xffff49,0xffffff},
.mc6847_pal={0x000000,0x000000,0x9A3236,0xFFB700,0x6B2700,0x0D3A06,0x4C3AB4,0xBFC8AD,0xD47F00,0xC84EF0,0x41AF71,0x000000,0x30D200,0xC1E500,0x000000,0x000000}};

View File

@ -55,7 +55,7 @@ extern int loaded_lc_palette;
alt_u16 tc_h_samplerate, tc_h_samplerate_adj, tc_h_synclen, tc_h_bporch, tc_h_active, tc_v_synclen, tc_v_bporch, tc_v_active, tc_sampler_phase, tc_h_mask, tc_v_mask;
alt_u8 menu_active;
alt_u8 vm_sel, vm_edit;
alt_u8 vm_sel, vm_edit, palset_type_sel;
static const char* const off_on_desc[] = { LNG("Off","オフ"), LNG("On","オン") };
static const char* const video_lpf_desc[] = { LNG("Auto","オート"), LNG("Off","オフ"), "95MHz (HDTV II)", "35MHz (HDTV I)", "16MHz (EDTV)", "9MHz (SDTV)" };
@ -90,10 +90,11 @@ static const char* const auto_input_desc[] = { "Off", "Current input", "All inpu
static const char* const mask_color_desc[] = { "Black", "Blue", "Green", "Cyan", "Red", "Magenta", "Yellow", "White" };
static const char* const av3_alt_rgb_desc[] = { "Off", "AV1", "AV2" };
static const char* const shmask_mode_desc[] = { "Off", "A-Grille", "TV", "PVM", "PVM-2530", "XC-3315C", "C-1084", "JVC", "VGA", c_shmask.name };
static const char* const lumacode_mode_desc[] = { "Off", "C64", "Spectrum", "Coleco/MSX", "Intellivision", "NES", "Atari GTIA", "Atari VCS" };
static const char* const lumacode_pal_desc[] = { "PAL", c_lc_palette_set.name };
static const char* const lumacode_mode_desc[] = { "Off", "VIC20", "C64", "Spectrum", "Coleco/MSX", "Intellivision", "G7000", "MC6847", "Master System", "NES", "Atari GTIA", "Atari VCS", "Atari 7800" };
static const char* const lumacode_pal_desc[] = { "PAL", "NTSC", c_lc_palette_set.name };
static const char* const adc_pll_bw_desc[] = { "High", "Medium", "Low", "Ultra low" };
static const char* const fpga_pll_bw_desc[] = { "High", "Low" };
static const char* const palset_type_arr[] = { "Custom .txt", "NES .pal" };
static void sync_vth_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%d mV", (v*1127)/100); }
static void intclks_to_time_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%u.%.2u us", (unsigned)(((1000000U*v)/(TVP_INTCLK_HZ/1000))/1000), (unsigned)((((1000000U*v)/(TVP_INTCLK_HZ/1000))%1000)/10)); }
@ -117,11 +118,13 @@ static void alc_v_filter_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, LN
static void alc_h_filter_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, LNG("%u pixels","%u ドット"), (1<<(v+1))); }
void sampler_phase_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%d deg", (v*11250)/1000); }
//static void coarse_gain_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%u.%u", ((v*10)+50)/100, (((v*10)+50)%100)/10); }
static void palset_type_disp(uint8_t v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%s", palset_type_arr[v]); }
static arg_info_t vm_arg_info = {&vm_sel, 0, vm_display_name};
static const arg_info_t profile_arg_info = {&profile_sel_menu, MAX_PROFILE, profile_disp};
static const arg_info_t sd_profile_arg_info = {&sd_profile_sel_menu, MAX_SD_PROFILE, sd_profile_disp};
static const arg_info_t lt_arg_info = {&lt_sel, (sizeof(lt_desc)/sizeof(char*))-1, lt_disp};
static const arg_info_t palset_arg_info = {&palset_type_sel, 1, palset_type_disp};
MENU(menu_advtiming, P99_PROTECT({ \
@ -172,7 +175,7 @@ MENU(menu_vinput_opt, P99_PROTECT({ \
{ "ALC H filter", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.alc_h_filter, OPT_NOWRAP, 0, ALC_H_FILTER_MAX, alc_h_filter_disp } } },
{ "Lumacode", OPT_AVCONFIG_SELECTION, { .sel = { &tc.lumacode_mode, OPT_WRAP, SETTING_ITEM(lumacode_mode_desc) } } },
{ "Lc palette set", OPT_AVCONFIG_SELECTION, { .sel = { &tc.lumacode_pal, OPT_WRAP, SETTING_ITEM(lumacode_pal_desc) } } },
{ "<Custom Lc-set>", OPT_CUSTOMMENU, { .cstm = { &cstm_lc_palette_set_load } } },
{ "Palette set load", OPT_CUSTOMMENU, { .cstm = { &cstm_lc_palette_set_load, &palset_arg_info } } },
}))
MENU(menu_sync, P99_PROTECT({ \
@ -331,14 +334,7 @@ void write_option_value(const menuitem_t *item, int func_called, int retval)
item->num_u16.df(item->num_u16.data);
break;
case OPT_SUBMENU:
if (item->sub.arg_info)
item->sub.arg_info->df(*item->sub.arg_info->data);
else
menu_row2[0] = 0;
break;
case OPT_CUSTOMMENU:
menu_row2[0] = 0;
break;
case OPT_FUNC_CALL:
if (func_called) {
if (retval == 0)
@ -487,21 +483,12 @@ void display_menu(alt_u8 forcedisp)
*val_u16 = (*val_u16 < val_u16_max) ? (*val_u16+1) : (val_wrap ? val_u16_min : val_u16_max);
break;
case OPT_SUBMENU:
case OPT_CUSTOMMENU:
case OPT_FUNC_CALL:
if (item->sub.arg_info) {
val = item->sub.arg_info->data;
val_max = item->sub.arg_info->max;
if (item->sub.arg_info) {
if (code == VAL_MINUS)
*val = (*val > 0) ? (*val-1) : 0;
else
*val = (*val < val_max) ? (*val+1) : val_max;
}
break;
case OPT_FUNC_CALL:
val = item->fun.arg_info->data;
val_max = item->fun.arg_info->max;
if (item->fun.arg_info) {
if (code == VAL_MINUS)
*val = (*val > 0) ? (*val-1) : 0;
else
@ -522,7 +509,7 @@ void display_menu(alt_u8 forcedisp)
write_option_value(item, func_called, retval);
strncpy((char*)osd->osd_array.data[navi[navlvl].mp][1], menu_row2, OSD_CHAR_COLS);
osd->osd_row_color.mask = (1<<navi[navlvl].mp);
if (func_called || ((item->type == OPT_FUNC_CALL) && item->fun.arg_info != NULL) || ((item->type == OPT_SUBMENU) && item->sub.arg_info != NULL))
if (func_called || ((item->type >= OPT_SUBMENU) && (item->type <= OPT_FUNC_CALL) && item->fun.arg_info != NULL))
osd->osd_sec_enable[1].mask |= (1<<navi[navlvl].mp);
ui_disp_menu(0);
@ -627,6 +614,45 @@ int load_shmask(char *dirname, char *filename) {
return 0;
}
int load_lc_nes_pal(char *dirname, char *filename) {
FIL f_nes_pal;
int i;
char dirname_root[10];
unsigned bytes_read;
if (!sdcard_dev.mount) {
if (file_mount() != 0) {
printf("SD card not detected\n");
return -1;
}
}
sniprintf(dirname_root, sizeof(dirname_root), "/%s", dirname);
f_chdir(dirname_root);
if (!file_open(&f_nes_pal, filename)) {
if (f_read(&f_nes_pal, tmpbuf, 192, &bytes_read) == FR_OK) {
memset(c_lc_palette_set.pal.nes_pal, 0x00, sizeof(c_lc_palette_set.pal.nes_pal));
for (i=0x00; i<=0x0C; i++)
c_lc_palette_set.pal.nes_pal[i+8] = (tmpbuf[3*i]<<16) | (tmpbuf[3*i+1]<<8) | tmpbuf[3*i+2];
for (i=0x10; i<=0x1C; i++)
c_lc_palette_set.pal.nes_pal[i+6] = (tmpbuf[3*i]<<16) | (tmpbuf[3*i+1]<<8) | tmpbuf[3*i+2];
for (i=0x20; i<=0x2D; i++)
c_lc_palette_set.pal.nes_pal[i+4] = (tmpbuf[3*i]<<16) | (tmpbuf[3*i+1]<<8) | tmpbuf[3*i+2];
for (i=0x30; i<=0x3D; i++)
c_lc_palette_set.pal.nes_pal[i+2] = (tmpbuf[3*i]<<16) | (tmpbuf[3*i+1]<<8) | tmpbuf[3*i+2];
}
file_close(&f_nes_pal);
}
f_chdir("/");
sniprintf(c_lc_palette_set.name, sizeof(c_lc_palette_set.name), "C: %s", filename);
loaded_lc_palette = -1;
update_sc_config();
return 0;
}
int load_lc_palette_set(char *dirname, char *filename) {
FIL f_lc_palset;
char dirname_root[10];
@ -671,9 +697,27 @@ int load_lc_palette_set(char *dirname, char *filename) {
} else if (strncmp(tmpbuf, "tia_pal", 10) == 0) {
offset = offsetof(lc_palette_set, tia_pal)/4;
entries_remaining = 128;
} else if (strncmp(tmpbuf, "gtia_pal", 10) == 0) {
offset = offsetof(lc_palette_set, gtia_pal)/4;
entries_remaining = 256;
} else if (strncmp(tmpbuf, "maria_pal", 10) == 0) {
offset = offsetof(lc_palette_set, maria_pal)/4;
entries_remaining = 256;
} else if (strncmp(tmpbuf, "gtia_pal", 10) == 0) {
offset = offsetof(lc_palette_set, gtia_pal)/4;
entries_remaining = 128;
} else if (strncmp(tmpbuf, "sms_pal", 10) == 0) {
offset = offsetof(lc_palette_set, sms_pal)/4;
entries_remaining = 64;
} else if (strncmp(tmpbuf, "vic20_pal", 10) == 0) {
offset = offsetof(lc_palette_set, vic20_pal)/4;
entries_remaining = 16;
} else if (strncmp(tmpbuf, "g7000_pal", 10) == 0) {
offset = offsetof(lc_palette_set, g7000_pal)/4;
entries_remaining = 16;
} else if (strncmp(tmpbuf, "mc6847_pal", 10) == 0) {
offset = offsetof(lc_palette_set, mc6847_pal)/4;
entries_remaining = 16;
}
} else if (sscanf(tmpbuf, "%lx,%lx,%lx,%lx,%lx,%lx,%lx,%lx,%lx,%lx,%lx,%lx,%lx,%lx,%lx,%lx", &c_lc_palette_set.pal.data[offset],
&c_lc_palette_set.pal.data[offset+1],
@ -829,7 +873,15 @@ void cstm_shmask_load(menucode_id code, int setup_disp) {
}
void cstm_lc_palette_set_load(menucode_id code, int setup_disp) {
switch (palset_type_sel) {
case 0:
cstm_file_load(code, setup_disp, "lumacode", "*.txt", load_lc_palette_set);
break;
case 1:
default:
cstm_file_load(code, setup_disp, "lumacode", "*.pal", load_lc_nes_pal);
break;
}
}
void cstm_fw_update(menucode_id code, int setup_disp) {

View File

@ -72,7 +72,7 @@ const ude_item_map ude_initcfg_items[] = {
const ude_item_map ude_profile_items[] = {
{{0, 120, sizeof(video_modes_plm_default)}, video_modes_plm},
UDE_ITEM(1, 120, c_shmask),
UDE_ITEM(65, 120, c_lc_palette_set),
UDE_ITEM(65, 121, c_lc_palette_set),
// avconfig_t
UDE_ITEM(2, 120, tc.pm_240p),
UDE_ITEM(3, 120, tc.pm_384p),
@ -111,8 +111,8 @@ const ude_item_map ude_profile_items[] = {
UDE_ITEM(36, 120, tc.reverse_lpf),
UDE_ITEM(37, 120, tc.shmask_mode),
UDE_ITEM(38, 120, tc.shmask_str),
UDE_ITEM(39, 120, tc.lumacode_mode),
UDE_ITEM(40, 120, tc.lumacode_pal),
UDE_ITEM(39, 121, tc.lumacode_mode),
UDE_ITEM(40, 121, tc.lumacode_pal),
UDE_ITEM(41, 120, tc.sync_vth),
UDE_ITEM(42, 120, tc.linelen_tol),
UDE_ITEM(43, 120, tc.vsync_thold),