Skip to content

Commit 8d1afb0

Browse files
author
r-lyeh
committed
v1.17-WIP
chg: improved UX while browsing local files chg: tweak spectrum luminance on pcw/amber palettes new: try to detect border color when loading .scr files chg: zxdb new downloads order: dsk > pzx > tzx > tap new: quirkafleeg,II,origins palettes chg: center gallery thumbnails horizontally (fullscreen) chg: update zxdb to latest (234->235)
1 parent 3c5084f commit 8d1afb0

13 files changed

Lines changed: 1518 additions & 125 deletions

File tree

MAKE.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ ping -n 2 -w 1500 localhost > nul && rem wait 1s between 2 consecutive pings, so
251251
where /q rcedit-x64 || curl -LO https://github.com/electron/rcedit/releases/download/v2.0.0/rcedit-x64.exe
252252
where /q rcedit-x64 && ^
253253
rcedit-x64 "Spectral.exe" --set-file-version "!year!.!month!.!today!.!today!!month!" && ^
254-
rcedit-x64 "Spectral.exe" --set-product-version "1.16" && ^
254+
rcedit-x64 "Spectral.exe" --set-product-version "1.17-WIP" && ^
255255
rcedit-x64 "Spectral.exe" --set-icon src\res\img\noto_1f47b.ico || goto error
256256

257257
if "%__DOTNET_PREFERRED_BITNESS%"=="32" (

src/app.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ int _getch();
77
#define fileno _fileno // fucking m$
88
*/
99

10-
/* planned for v1.16
10+
/* planned for v1.17
1111
12-
- [x] allow to mount custom roms
1312
- [ ] irc/lobby (mount server)
1413
- [ ] <3<3<3 rating system
1514
- [ ] standalone .ini options
@@ -20,7 +19,8 @@ int _getch();
2019
- [ ] multiplayer
2120
- [ ] 57 Documentation please!
2221
- [ ] ARM builds (Linux+Win)
23-
- [ ] invert tape polarity (ZX == 200)
22+
- [ ] invert tape polarity (if ZX == 200)
23+
- [ ] pzx: darkstar (PAUSE_REMOVE)
2424
2525
*/
2626

@@ -327,7 +327,7 @@ void loggers(int m);
327327
// [ ] XL1 (Compilation)
328328
#endif
329329

330-
#define SPECTRAL "v1.16"
330+
#define SPECTRAL "v1.17-WIP"
331331

332332
#ifndef DEV
333333
#if NDEBUG >= 2
@@ -1915,7 +1915,7 @@ void draw_ui() {
19151915

19161916
char* game_browser(int version) { // returns true if loaded
19171917
// scan files
1918-
if( !numgames && !zxdb_loaded() ) {
1918+
if( !numgames && (!zxdb_loaded() || ZX_BROWSER == 0) ) {
19191919
do_once {
19201920
uint64_t then = time_ns();
19211921
const char *folder = ZX_FOLDER;

src/app_lib.h

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,8 @@ struct queue_t {
286286
zxdb z;
287287
char *url;
288288
};
289-
void* queue_values[144]; // 12x12 thumbnails max
290-
void* queue_values2[144]; // 12x12 thumbnails max
289+
void* queue_values[12*12]; // 12x12 thumbnails max
290+
void* queue_values2[12*12]; // 12x12 thumbnails max
291291
struct queue_t *queue_t_new(zxdb z,const char *url) {
292292
struct queue_t *q = malloc(sizeof(struct queue_t));
293293
q->z = zxdb_dup(z);
@@ -908,7 +908,7 @@ char* game_browser_v2() {
908908
// background (text mode only)
909909

910910
static rgba *background_texture = 0;
911-
// if( thumbnails == 0 )
911+
if( thumbnails == 0 )
912912
if( background_texture ) {
913913
#if 0
914914
int factor = 0, f256 = 256/(1<<factor), f192 = 192/(1<<factor);
@@ -1364,24 +1364,19 @@ char* game_browser_v2() {
13641364
ui_y--; // compact
13651365
}
13661366
else {
1367-
int t = thumbnails;
1368-
int w = _320/t, h = (_240-16)/t;
1369-
int x = (cnt % t) * w, y = 16 + (cnt / t) * h;
1367+
int t = thumbnails, _16 = 16; // _16 = 28; // progress_y+2;
1368+
int w = _320/t, h = (_240-_16)/t;
1369+
int x = (cnt % t) * w, y = _16 + (cnt / t) * h;
13701370
int has_thumb = 0;
13711371

1372-
int factor = t == 3 ? 1 : t == 6 ? 2 : 3;
1372+
int factor = t >= 12 ? 3 : t >= 6 ? 2 : t >= 3 ? 1 : 0;
13731373
const char *data = zxdb_screen_async(va("#%.*s", zx_id_len, zx_id), &len, factor);
13741374
if( data && len ) {
13751375
// blit
13761376
const rgba *bitmap = (rgba*)data;
13771377
int f256 = 256/(1<<factor), f192 = 192/(1<<factor);
1378-
#if 0
1379-
for(int i = 0; i < f192; ++i) {
1380-
memcpy(&ui->pix[x+(y+i)*_320], bitmap + (0+i*f256), f256*4);
1381-
}
1382-
#else
1383-
rgba_blit(ui, bitmap, x,y, 0,0,f256,f192);
1384-
#endif
1378+
int cx = (_320-_256)/t/2, cy = ((_240-_16)-_192)/t/2;
1379+
rgba_blit(ui, bitmap, x+cx,y+0*cy, 0,0,f256,f192);
13851380

13861381
has_thumb = 1;
13871382
}
@@ -1426,15 +1421,11 @@ char* game_browser_v2() {
14261421
mouse_cursor(2);
14271422
ui_notify(full_title);
14281423
clicked = m.lb;
1424+
}
14291425

1430-
// prepare to blit larger preview
1431-
if( thumbnails == 12 ) {
1432-
larger_preview = (const rgba *)zxdb_screen_async(va("#%.*s", zx_id_len, zx_id), NULL, larger_factor = 1);
1433-
}
1434-
else
1435-
if( thumbnails == 6 ) {
1436-
larger_preview = (const rgba *)zxdb_screen_async(va("#%.*s", zx_id_len, zx_id), NULL, larger_factor = 1);
1437-
}
1426+
// prepare to blit larger preview
1427+
if( thumbnails >= 6 ) {
1428+
larger_preview = (const rgba *)zxdb_screen_async(va("#%.*s", zx_id_len, zx_id), NULL, larger_factor = 1);
14381429
}
14391430
}
14401431
}
@@ -1492,15 +1483,22 @@ char* game_browser_v2() {
14921483
if( larger_preview ) {
14931484
int f256 = 256/(1<<larger_factor), f192 = 192/(1<<larger_factor);
14941485

1495-
int x = mouse().x; // x = (x + f256) > _320 ? x - f256 : x;
1496-
int y = mouse().y; // y = (y + f192) > _240 ? y - f192 : y;
1486+
int x = mouse().x;
1487+
int y = mouse().y;
1488+
1489+
{float dt = x / (float)_320; x += 8; x -= (f256 + 8*2) * dt; }
1490+
// {float dt = y / (float)_240; y += 16; y -= (f192 + 16*2) * dt; }
1491+
1492+
// x = (x + f256) > _320 ? x - f256 - 8 : x + 8;
1493+
y = (y + f192) > _240 ? y - f192 - 16 : y + 16;
14971494

1495+
static float alpha = 0.75;
14981496
static float at_x = 0, at_y = 0; do_once at_x = x, at_y = y;
1499-
at_x = at_x * 0.90 + x * 0.10;
1500-
at_y = at_y * 0.90 + y * 0.10;
1497+
at_x = at_x * alpha + x * (1-alpha);
1498+
at_y = at_y * alpha + y * (1-alpha);
15011499

15021500
rgba_blit(ui, larger_preview, at_x,at_y, 0,0,f256,f192);
1503-
ui_rect(ui, at_x-1,at_y-1,at_x+f256+1,at_y+f192+1);
1501+
ui_rect(ui, at_x-1,at_y-1,at_x+f256+1-1,at_y+f192+1-1);
15041502
}
15051503

15061504
}

0 commit comments

Comments
 (0)