From c3729edf17ed81d33de5b805688f2dde3d96980d Mon Sep 17 00:00:00 2001 From: Lephe Date: Sat, 27 Jul 2019 19:54:52 -0400 Subject: [PATCH] gray rendering, hexadecimal memory viewer --- .gitignore | 4 +- Makefile | 89 ++++++++++------ assets-fx/fonts/hexa.png | Bin 0 -> 747 bytes assets-fx/img/opt_gint_gray.png | Bin 0 -> 2164 bytes assets-fx/{ => img}/opt_gint_timers.png | Bin assets-fx/{ => img}/opt_main.png | Bin assets-fx/img/opt_mem.png | Bin 0 -> 2767 bytes assets-fx/{ => img}/opt_perf_libprof.png | Bin assets-fx/{ => img}/opt_perf_render.png | Bin assets-fx/img/profile_gray.png | Bin 0 -> 202 bytes assets-fx/img/profile_gray_alpha.png | Bin 0 -> 208 bytes assets-fx/img/profile_mono.png | Bin 0 -> 178 bytes assets-fx/img/profile_mono_alpha.png | Bin 0 -> 193 bytes include/gintctl/gint.h | 10 ++ include/gintctl/mem.h | 11 ++ project.cfg | 22 ++++ src/gint/gray.c | 130 +++++++++++++++++++++++ src/gint/timer.c | 4 +- src/gintctl.c | 11 +- src/mem/mem.c | 77 ++++++++++++++ src/perf/libprof.c | 4 +- src/perf/render.c | 4 +- 22 files changed, 322 insertions(+), 44 deletions(-) mode change 100755 => 100644 Makefile create mode 100644 assets-fx/fonts/hexa.png create mode 100644 assets-fx/img/opt_gint_gray.png rename assets-fx/{ => img}/opt_gint_timers.png (100%) rename assets-fx/{ => img}/opt_main.png (100%) create mode 100644 assets-fx/img/opt_mem.png rename assets-fx/{ => img}/opt_perf_libprof.png (100%) rename assets-fx/{ => img}/opt_perf_render.png (100%) create mode 100644 assets-fx/img/profile_gray.png create mode 100644 assets-fx/img/profile_gray_alpha.png create mode 100644 assets-fx/img/profile_mono.png create mode 100644 assets-fx/img/profile_mono_alpha.png create mode 100644 include/gintctl/mem.h create mode 100644 project.cfg create mode 100644 src/gint/gray.c create mode 100644 src/mem/mem.c diff --git a/.gitignore b/.gitignore index 1fda17e..723a319 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ # Build directories -build.fx/ -build.cg/ +build-fx/ +build-cg/ # Targets gintctl.g1a diff --git a/Makefile b/Makefile old mode 100755 new mode 100644 index 57ed664..991c2ba --- a/Makefile +++ b/Makefile @@ -1,53 +1,69 @@ #! /usr/bin/make -f -# Makefile for the gint control add-in +# Default Makefile for fxSDK add-ins. This file was probably copied there by +# the [fxsdk] program. #--- # # Configuration # +include project.cfg + # Compiler flags -cf := -mb -ffreestanding -nostdlib -Wall -Wextra -std=c11 -Os \ - -fstrict-volatile-bitfields -I include +cf := -mb -ffreestanding -nostdlib -Wall -Wextra \ + -fstrict-volatile-bitfields $(CFLAGS) cf-fx := $(cf) -m3 -DFX9860G cf-cg := $(cf) -m4-nofpu -DFXCG50 # Linker flags -lf-fx := -Tfx9860g.ld -lprof -lgint-fx -lgcc -Wl,-Map=build.fx/map -lf-cg := -Tfxcg50.ld -lprof -lgint-cg -lgcc -Wl,-Map=build.cg/map +lf-fx := $(LDFLAGS) -Tfx9860g.ld -lgint-fx -lgcc -Wl,-Map=build-fx/map +lf-cg := $(LDFLAGS) -Tfxcg50.ld -lgint-cg -lgcc -Wl,-Map=build-cg/map dflags = -MMD -MT $@ -MF $(@:.o=.d) -MP cpflags := -R .bss -R .gint_bss -g1af := -i assets-fx/icon.png -n gintctl --internal=@GINTCTL -g3af := -n basic:" " -i uns:assets-cg/icon-uns.png \ - -i sel:assets-cg/icon-sel.png +g1af := -i "$(ICON_FX)" -n "$(NAME)" --internal="$(INTERNAL)" +g3af := -n basic:"$(NAME)" -i uns:"$(ICON_CG_UNS)" -i sel:"$(ICON_CG_SEL)" # # File listings # -elf = $(dir $<)gintctl.elf -bin = $(dir $<)gintctl.bin -target-fx := gintctl.g1a -target-cg := gintctl.g3a +null := +filename := $(subst $(null) $(null),-,$(NAME)) -# Source and object files -src := $(shell find src -name '*.c') -assets-fx := $(wildcard assets-fx/*.png) -assets-cg := $(wildcard assets-cg/*.png) -obj-fx := $(src:%.c=build.fx/%.o) $(assets-fx:assets-fx/%=build.fx/%.o) -obj-cg := $(src:%.c=build.cg/%.o) $(assets-ch:assets-cg/%=build.cg/%.o) +elf = $(dir $<)$(filename).elf +bin = $(dir $<)$(filename).bin +target-fx := $(filename).g1a +target-cg := $(filename).g3a + +# Source files +src := $(wildcard src/*.c src/*/*.c src/*/*/*.c src/*/*/*/*.c) +assets-fx := $(wildcard assets-fx/*/*) +assets-cg := $(wildcard assets-cg/*/*) + +# Object files +obj-fx := $(src:%.c=build-fx/%.o) $(assets-fx:assets-fx/%=build-fx/assets/%.o) +obj-cg := $(src:%.c=build-cg/%.o) $(assets-cg:assets-cg/%=build-cg/assets/%.o) # Additional dependencies -deps-fx := assets-fx/icon.png -deps-cg := assets-cg/icon-uns.png assets-cg/icon-sel.png +deps-fx := $(ICON_FX) +deps-cg := $(ICON_CG_UNS) $(ICON_CG_SEL) + +# All targets +all := +ifneq "$(wildcard build-fx)" "" +all += all-fx +endif +ifneq "$(wildcard build-cg)" "" +all += all-cg +endif # # Build rules # -all: all-fx all-cg +all: $(all) all-fx: $(target-fx) all-cg: $(target-cg) @@ -65,21 +81,32 @@ $(target-cg): $(obj-cg) $(deps-cg) mkg3a $(g3af) $(bin) $@ # C sources -build.fx/%.o: %.c +build-fx/%.o: %.c @ mkdir -p $(dir $@) sh3eb-elf-gcc -c $< -o $@ $(cf-fx) $(dflags) -build.cg/%.o: %.c +build-cg/%.o: %.c @ mkdir -p $(dir $@) sh4eb-elf-gcc -c $< -o $@ $(cf-cg) $(dflags) # Images -build.fx/%.png.o: assets-fx/%.png +build-fx/assets/img/%.o: assets-fx/img/% @ mkdir -p $(dir $@) - fxconv -i $< -o $@ name:$* -build.cg/%.png.o: assets-cg/%.png - @ echo -e "\e[31;1mWARNING: conversion for fxcg50 not supported yet\e[0m" + fxconv -i $< -o $@ name:img_$(basename $*) + +build-cg/assets/img/%.o: assets-cg/img/% + @ echo -ne "\e[31;1mWARNING: image conversion for fxcg50 is not " + @ echo -ne "supported yet\e[0m" @ mkdir -p $(dir $@) - fxconv -i $< -o $@ name:$* + fxconv -i $< -o $@ name:img_$(basename $*) + +# Fonts +build-fx/assets/fonts/%.o: assets-fx/fonts/% + @ mkdir -p $(dir $@) + fxconv -f $< -o $@ name:font_$(basename $*) $(FONT.$*) + +build-cg/assets/fonts/%.o: assets-cg/fonts/% + @ mkdir -p $(dir $@) + fxconv -f $< -o $@ name:font_$(basename $*) $(FONT.$*) # # Cleaning and utilities @@ -87,9 +114,9 @@ build.cg/%.png.o: assets-cg/%.png # Dependency information -include $(shell find build* -name *.d 2> /dev/null) -build.fx/%.d: ; -build.cg/%.d: ; -.PRECIOUS: build.fx build.cg build.fx/%.d build.cg/%.d %/ +build-fx/%.d: ; +build-cg/%.d: ; +.PRECIOUS: build-fx build-cg build-fx/%.d build-cg/%.d %/ clean: @ rm -rf build* diff --git a/assets-fx/fonts/hexa.png b/assets-fx/fonts/hexa.png new file mode 100644 index 0000000000000000000000000000000000000000..1841de19d88a287601239a57ab0bb44c41460d99 GIT binary patch literal 747 zcmV`ejYg^d`eha3wzC$cBMKw{Sb%eVmtmM|=eq_A^Txpd&92^?n*YcHg*An+n(5tBui^n7;*QNV%W-xPMN+#j(_?aw)$|(&i0$s zk`TraX;Eplg>bx(N{uxSX)P6vJg{^Vg?U=Cvtmu_hE_zpb{E?Nb5S3Kp=yP$TL6-L zNMOnS)<*1^+MB2J4=llnIpXbZoHFEHI-w-|#HFnu+tp82h9!|OekF!eipy(>NE$z} z8;8UqoQFjK_Q28|6i%z<6qY!6l)LFhytHI*xC~2fWp~NrmgNM}A{+{n7Ece+-Qr1= z^nJJTA9)QeB0#*fD5S@TS^|mHuQ+R_5BYF-2_~S$Rlv)swGL5hgg>x!Pgv4jw7~MW zZVNaL6%}?rmk> zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3yclI6G!ME|u4FF_y(kX#O5i0}@)d>=};s%zR4 zo^gbwuB#Ub0?0&yeeHk!Gp>Jd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eU z=0y`kfkAB1#l5Wm$ARu`t8ejt9&B$2cq2gH4^rK*C|9KD|F1c|XeIYbAZdkGhB;ma zd16<52JNkXAL9=3+%bL};m@DP@KME{dEa1Q&1heP%+E*P)RQ^tAiG;^Ip3sJPg?j& zns{%+knK0QbG@ye#GCi($N#fJRCGPc1P#O^;k~Z8g5d)mRzp>=Yf*8Z1O3^Ub_#0U zyt;}r!g_8wiRYMtQMAH)RY%w*Ur$&K(_K*nHXNGR-JnAL$Z^A8d3sSB4KqqgG$b|$ zBqt6ZAPkRWdL-Ckday65T&EV%3ip1Mz-a|O3^KeNtf#pFW-vNRcP|7BwY4()cK71a zMQZg{BZgogIOs&i=eggjm@D)jkA?H!u3NrGyOg1Ui8@Hj#K8hCHaKEr)C)l z4|V#xJ4^Vs`tFF_Y2gB}DH{Gu^L2ZGeEb^{T3^ubsl>+s000SaNLh0L01FcU01FcV z0GgZ_00007bV*G`2jd4C6fhJIGeJcF008GnL_t(o!|hnx4#OY_m4*NRW%e{e4%1n+ z)e+7^LsPNkc94>Ylv0SO3}K1-Ut`jCu6a{Lte~E1yie7=uD#BD^qH7RqnF)QlBLOLA`ghKDJogbrnD7C=Bunc^Gf_^fZ_u5!e z>psD1!um%{XE z)7O>#F}t*YfnHfxxF1j`)6>NCMbEF z;tX+N_>rh~jwLp@_*&{OJz*Z>?%7eR*;S{j@633*QmOsI!vgLHSFXwXXRUR;Q!W3i v?D9je4at5N9E5IsI+Z!=>iqfd)A;$1ue6jpEl_U*w3NZq)z4*}Q$iB}y4FO7 literal 0 HcmV?d00001 diff --git a/assets-fx/img/profile_gray_alpha.png b/assets-fx/img/profile_gray_alpha.png new file mode 100644 index 0000000000000000000000000000000000000000..45ec67f29b1f88b489345a00125475ad2d014e7e GIT binary patch literal 208 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP>{XE z)7O>#F}t)FpODO2ACU5VPZ!4!i_>d^9r+F@aAfo5KbdSJO|kqS@ge8plj~=lBJ!(#aDGL@-;ro0Ig>5boFyt=akR{0JZ%^ ALI3~& literal 0 HcmV?d00001 diff --git a/assets-fx/img/profile_mono.png b/assets-fx/img/profile_mono.png new file mode 100644 index 0000000000000000000000000000000000000000..d1b2e998d3878d975cf2745e41d7ec92bddca313 GIT binary patch literal 178 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|oCO|{#S9GG!XV7ZFl&wkP>{XE z)7O>#F}pOs1=H-0p)Y_!fu1goAsXk8PBP?UP~c#WKJ{XE z)7O>#F}pOsg^s&=ggQ_t!PCVt#NzbY;EQ|=iX2SO|Nl4oUb1#))XI-xl0p)yoV*qc z6J(^-_eH$kE}neX|H;OKOFv!gJ=kp0_@3{Sn&11LtSzfHR|a}sxzMuy)7b`pwT;4y lL!Z7^3(OTZp8vA5Q~vc%LxlvJ;sl^w44$rjF6*2UngF?kK=%Lu literal 0 HcmV?d00001 diff --git a/include/gintctl/gint.h b/include/gintctl/gint.h index b9c7480..3821bed 100644 --- a/include/gintctl/gint.h +++ b/include/gintctl/gint.h @@ -11,4 +11,14 @@ void gintctl_gint_hardware(void); /* gintctl_gint_timer(): Show the timer status in real-time */ void gintctl_gint_timer(void); +#ifdef FX9860G + +/* gintctl_gint_gray(): Gray engine tuning */ +void gintctl_gint_gray(void); + +/* gintctl_gint_grayrender(): Gray rendering functions */ +void gintctl_gint_grayrender(void); + +#endif /* FX9860G */ + #endif /* GINTCTL_GINT */ diff --git a/include/gintctl/mem.h b/include/gintctl/mem.h new file mode 100644 index 0000000..1e6d2d8 --- /dev/null +++ b/include/gintctl/mem.h @@ -0,0 +1,11 @@ +//--- +// gintctl:mem - Memory browser +//--- + +#ifndef GINTCTL_MEM +#define GINTCTL_MEM + +/* gintctl_mem(): Memory browser */ +void gintctl_mem(void); + +#endif /* GINTCTL_MEM */ diff --git a/project.cfg b/project.cfg new file mode 100644 index 0000000..e14bd80 --- /dev/null +++ b/project.cfg @@ -0,0 +1,22 @@ +#--- +# fxSDK project configuration file for gintctl +#--- + +# Project name, should be at most 8 bytes long. +NAME = gintctl +# Internal name, should be '@' followed by at most 7 uppercase letters. +INTERNAL = @GINTCTL + +# fx-9860G icon location +ICON_FX = assets-fx/icon.png +# fx-CG 50 icon locations +ICON_CG_UNS = assets-cg/icon-uns.png +ICON_CG_SEL = assets-cg/icon-sel.png + +# Additional compiler flags +CFLAGS = -std=c11 -Os -I include +# Additional linker flags +LDFLAGS = -lprof + +# Parameters for the hexadecimal font on fx9860g +FONT.hexa.png = charset:print grid.size:3x5 grid.padding:1 diff --git a/src/gint/gray.c b/src/gint/gray.c new file mode 100644 index 0000000..d2dac3e --- /dev/null +++ b/src/gint/gray.c @@ -0,0 +1,130 @@ +#ifdef FX9860G + +#include +#include +#include +#include +#include + +/* gintctl_gint_gray(): Gray engine tuning */ +void gintctl_gint_gray(void) +{ + uint32_t delays[2]; + gray_config(&delays[0], &delays[1]); + + int key = 0, sel = 0; + char str[20]; + + gray_start(); + + while(key != KEY_EXIT) + { + gclear(C_WHITE); + + gtext(1, 0, "Gray engine tuning", C_BLACK, C_NONE); + + sprintf(str, "Light%5u", delays[0]); + gtext(13, 24, str, C_BLACK, C_NONE); + sprintf(str, "Dark %5u", delays[1]); + gtext(13, 32, str, C_BLACK, C_NONE); + + int y = 24 + (sel << 3); + gtext(7, y, "<", C_BLACK, C_NONE); + gtext(73, y, ">", C_BLACK, C_NONE); + + grect(96, 16, 127, 31, C_LIGHT); + grect(96, 32, 127, 47, C_DARK); + + extern image_t img_opt_gint_gray; + gimage(0, 56, &img_opt_gint_gray); + + gupdate(); + key = getkey().key; + + if(key == KEY_UP && sel) sel = 0; + if(key == KEY_DOWN && !sel) sel = 1; + + if(key == KEY_LEFT) + delays[sel]--; + else if(key == KEY_RIGHT) + delays[sel]++; + else if(key == KEY_F1) + /* TODO: Default settings */ ; + else if(key == KEY_F2) + /* TODO: Default settings */ ; + else if(key == KEY_F3) + /* TODO: Default settings */ ; + else continue; + + if(delays[sel] < 100) delays[sel] = 100; + if(delays[sel] > 3000) delays[sel] = 3000; + gray_delays(delays[0], delays[1]); + } + gray_stop(); +} + +/* gintctl_gint_grayrender(): Gray rendering functions */ +void gintctl_gint_grayrender(void) +{ + int x, y; + + gray_start(); + gclear(C_WHITE); + + gtext(1, 1, "Gray rendering", C_BLACK, C_NONE); + + x = 6, y = 12; + grect(x, y, x + 15, y + 15, C_WHITE); + grect(x + 16, y, x + 31, y + 15, C_LIGHT); + grect(x + 32, y, x + 47, y + 15, C_DARK); + grect(x + 48, y, x + 63, y + 15, C_BLACK); + grect(x, y, x + 63, y + 3, C_LIGHTEN); + grect(x, y + 12, x + 63, y + 15, C_DARKEN); + + x = 104, y = 0; + grect(x, y, x + 23, y + 32, C_BLACK); + gtext(x - 13, y + 1, "White", C_WHITE, C_NONE); + gtext(x - 13, y + 9, "Light", C_LIGHT, C_NONE); + gtext(x - 13, y + 17, "Dark", C_DARK, C_NONE); + gtext(x - 13, y + 25, "Black", C_BLACK, C_NONE); + + x = 76, y = 33; + grect(x, y, x + 12, y + 24, C_WHITE); + grect(x + 13, y, x + 25, y + 24, C_LIGHT); + grect(x + 26, y, x + 38, y + 24, C_DARK); + grect(x + 39, y, x + 51, y + 24, C_BLACK); + gtext(x + 8, y + 1, "Lighten", C_LIGHTEN, C_NONE); + gtext(x + 8, y + 9, "Darken", C_DARKEN, C_NONE); + gtext(x + 8, y + 17, "Invert", C_INVERT, C_NONE); + + extern image_t img_profile_mono; + extern image_t img_profile_mono_alpha; + extern image_t img_profile_gray; + extern image_t img_profile_gray_alpha; + + x = 8, y = 32; + for(int c = 0; c < 8; c++) + { + int z = x + 8 * c + 3; + gline(z, y, z + 3, y + 3, c); + gline(z - 1, y + 1, z - 3, y + 3, c); + gline(z + 2, y + 4, z, y + 6, c); + gline(z - 2, y + 4, z - 1, y + 5, c); + } + + x = 2, y = 42; + for(int j = 0; j < 20; j++) + for(int i = 0; i < 74; i++) + gpixel(x + i, y + j, (i ^ j) & 1 ? C_BLACK : C_WHITE); + gimage(x + 2, y + 2, &img_profile_mono); + gimage(x + 20, y + 2, &img_profile_mono_alpha); + gimage(x + 38, y + 2, &img_profile_gray); + gimage(x + 56, y + 2, &img_profile_gray_alpha); + + gupdate(); + getkey(); + + gray_stop(); +} + +#endif /* FX9860G */ diff --git a/src/gint/timer.c b/src/gint/timer.c index 9d9d1f8..0dd3458 100644 --- a/src/gint/timer.c +++ b/src/gint/timer.c @@ -102,8 +102,8 @@ void gintctl_gint_timer(void) if(tab == 2) show_etmu_1(); if(tab == 3) show_etmu_2(); - extern image_t opt_gint_timers; - dimage(0, 56, &opt_gint_timers); + extern image_t img_opt_gint_timers; + dimage(0, 56, &img_opt_gint_timers); #endif #ifdef FXCG50 diff --git a/src/gintctl.c b/src/gintctl.c index 06e08f9..93ee6b7 100644 --- a/src/gintctl.c +++ b/src/gintctl.c @@ -12,6 +12,7 @@ #include #include +#include #include @@ -41,7 +42,8 @@ struct menu menu_gint = { { "Image rendering", NULL }, { "Text rendering", NULL }, #ifdef FX9860G - { "Gray engine", NULL }, + { "Gray engine", gintctl_gint_gray }, + { "Gray rendering", gintctl_gint_grayrender }, #endif { NULL, NULL }, }}; @@ -139,7 +141,6 @@ void gintctl_main(void) #endif /* FXCG50 */ } - int main(GUNUSED int isappli, GUNUSED int optnum) { /* Initialize menu metadata */ @@ -161,8 +162,8 @@ int main(GUNUSED int isappli, GUNUSED int optnum) else gintctl_main(); #ifdef FX9860G - extern image_t opt_main; - dimage(0, 56, &opt_main); + extern image_t img_opt_main; + dimage(0, 56, &img_opt_main); #else fkey_action(1, "INFO"); fkey_menu(2, "GINT"); @@ -183,7 +184,7 @@ int main(GUNUSED int isappli, GUNUSED int optnum) if(key == KEY_F5) gintctl_regs(); if(key == KEY_F6) - /* TODO: Launch memory explorer */ { } + gintctl_mem(); if(!menu) continue; diff --git a/src/mem/mem.c b/src/mem/mem.c new file mode 100644 index 0000000..c4624a9 --- /dev/null +++ b/src/mem/mem.c @@ -0,0 +1,77 @@ +#include +#include +#include + +#include +#include + +int c(int c) +{ + return (c >= 0x20 && c < 0x7f) ? c : '.'; +} + +/* gintctl_mem(): Memory browser */ +void gintctl_mem(void) +{ + uint32_t base = 0x88010758; + int key = 0, ascii = 0; + + #ifdef FX9860G + extern font_t font_hexa; + font_t const *old_font = dfont(&font_hexa); + + char header[12]; + char bytes[24]; + + while(key != KEY_EXIT) + { + dclear(C_WHITE); + + uint32_t addr = base; + uint8_t *mem = (void *)addr; + + for(int i = 0; i <= 8; i++) + { + if(!ascii) + { + sprintf(header, "%08X:", addr); + } + else + { + for(int k = 0; k < 8; k++) + header[k] = c(mem[k]); + header[8] = 0; + } + + sprintf(bytes, "%02X%02X %02X%02X %02X%02X %02X%02X", + mem[0], mem[1], mem[2], mem[3], + mem[4], mem[5], mem[6], mem[7] + ); + + dtext( 5, 6 * i + 1, header, C_BLACK, C_NONE); + dtext(45, 6 * i + 1, bytes, C_BLACK, C_NONE); + + mem += 8; + addr += 8; + } + + extern image_t img_opt_mem; + dsubimage(0, 56, &img_opt_mem, 0, 0, 128, 8, DIMAGE_NONE); + + if(ascii) + { + dsubimage(107, 56, &img_opt_mem, 107, 9, 21, 8, DIMAGE_NONE); + } + + dupdate(); + key = getkey().key; + + if(key == KEY_UP) base -= 72; + if(key == KEY_DOWN) base += 72; + + if(key == KEY_F6) ascii = !ascii; + } + + dfont(old_font); + #endif +} diff --git a/src/perf/libprof.c b/src/perf/libprof.c index 6576b62..3ac7833 100644 --- a/src/perf/libprof.c +++ b/src/perf/libprof.c @@ -55,8 +55,8 @@ void gintctl_perf_libprof(void) row_print(6, 1, "Empty: %d us", empty); } - extern image_t opt_perf_libprof; - dimage(0, 56, &opt_perf_libprof); + extern image_t img_opt_perf_libprof; + dimage(0, 56, &img_opt_perf_libprof); #endif /* FX9860G */ #ifdef FXCG50 diff --git a/src/perf/render.c b/src/perf/render.c index d9f60a7..4183314 100644 --- a/src/perf/render.c +++ b/src/perf/render.c @@ -75,8 +75,8 @@ void gintctl_perf_render(void) row_print(6, 1, "rect3: %s", printtime(time.rect3)); } - extern image_t opt_perf_render; - dimage(0, 56, &opt_perf_render); + extern image_t img_opt_perf_render; + dimage(0, 56, &img_opt_perf_render); #endif #ifdef FXCG50