Merge branch 'master' into #374
This commit is contained in:
commit
e741a0d0e0
49
Makefile
49
Makefile
|
@ -1,6 +1,7 @@
|
|||
CC=gcc
|
||||
OPT=-O3 -Wall -std=c99
|
||||
OPT_ARM=-D__ARM_LINUX__
|
||||
OPT_PRO=-DTIC80_PRO
|
||||
|
||||
RM= rm -f
|
||||
|
||||
|
@ -24,14 +25,16 @@ MINGW_LINKER_FLAGS= \
|
|||
-mwindows
|
||||
|
||||
LINUX_INCLUDES= \
|
||||
`pkg-config --cflags gtk+-3.0`
|
||||
`pkg-config --cflags gtk+-3.0` \
|
||||
`sdl2-config --cflags`
|
||||
|
||||
LINUX_LIBS= \
|
||||
`pkg-config --libs gtk+-3.0`
|
||||
`pkg-config --libs gtk+-3.0` \
|
||||
`sdl2-config --static-libs`
|
||||
|
||||
LINUX64_LIBS= \
|
||||
$(LINUX_LIBS) \
|
||||
-Llib/linux
|
||||
-Llib/linux64
|
||||
|
||||
LINUX32_LIBS= \
|
||||
$(LINUX_LIBS) \
|
||||
|
@ -40,9 +43,19 @@ LINUX32_LIBS= \
|
|||
LINUX_ARM_LIBS= \
|
||||
-Llib/arm
|
||||
|
||||
LINUX_LINKER_FLAGS= \
|
||||
LINUX_LINKER_LTO_FLAGS= \
|
||||
-D_GNU_SOURCE \
|
||||
-lSDL2 \
|
||||
-llua \
|
||||
-lgif \
|
||||
-ldl \
|
||||
-lm \
|
||||
-lpthread \
|
||||
-lrt \
|
||||
-lz
|
||||
|
||||
LINUX_LINKER_FLAGS= \
|
||||
-D_GNU_SOURCE \
|
||||
-llua5.3 \
|
||||
-ldl \
|
||||
-lm \
|
||||
|
@ -275,27 +288,47 @@ mingw: $(DEMO_ASSETS) $(TIC80_DLL) $(TIC_O) bin/html.o bin/res.o
|
|||
$(CC) $(TIC_O) bin/html.o bin/res.o $(TIC80_A) $(OPT) $(INCLUDES) $(MINGW_LINKER_FLAGS) -o $(MINGW_OUTPUT)
|
||||
|
||||
mingw-pro:
|
||||
$(eval OPT += -DTIC80_PRO)
|
||||
$(eval OPT += $(OPT_PRO))
|
||||
make mingw OPT="$(OPT)"
|
||||
|
||||
run: mingw-pro
|
||||
$(MINGW_OUTPUT)
|
||||
|
||||
linux64-lto:
|
||||
$(CC) $(LINUX_INCLUDES) $(SOURCES) $(TIC80_SRC) $(SOURCES_EXT) $(OPT) $(INCLUDES) $(LINUX64_LIBS) $(LINUX_LINKER_FLAGS) -flto -o bin/tic
|
||||
$(CC) $(LINUX_INCLUDES) $(SOURCES) $(TIC80_SRC) $(SOURCES_EXT) $(OPT) $(INCLUDES) $(LINUX64_LIBS) $(LINUX_LINKER_LTO_FLAGS) -flto -o bin/tic
|
||||
|
||||
linux64-lto-pro:
|
||||
$(eval OPT += $(OPT_PRO))
|
||||
make linux64-lto OPT="$(OPT)"
|
||||
|
||||
linux32-lto:
|
||||
$(CC) $(LINUX_INCLUDES) $(SOURCES) $(TIC80_SRC) $(SOURCES_EXT) $(OPT) $(INCLUDES) $(LINUX32_LIBS) $(LINUX_LINKER_FLAGS) -flto -o bin/tic
|
||||
$(CC) $(LINUX_INCLUDES) $(SOURCES) $(TIC80_SRC) $(SOURCES_EXT) $(OPT) $(INCLUDES) $(LINUX32_LIBS) $(LINUX_LINKER_LTO_FLAGS) -flto -o bin/tic
|
||||
|
||||
linux32-lto-pro:
|
||||
$(eval OPT += $(OPT_PRO))
|
||||
make linux32-lto OPT="$(OPT)"
|
||||
|
||||
arm-lto:
|
||||
$(CC) $(OPT_ARM) $(SOURCES) $(TIC80_SRC) $(OPT) $(INCLUDES) $(LINUX_ARM_LIBS) $(LINUX_LINKER_FLAGS) -flto -o bin/tic
|
||||
$(CC) $(LINUX_INCLUDES) $(OPT_ARM) $(SOURCES) $(TIC80_SRC) $(OPT) $(INCLUDES) $(LINUX_ARM_LIBS) $(LINUX_LINKER_LTO_FLAGS) -flto -o bin/tic
|
||||
|
||||
arm-lto-pro:
|
||||
$(eval OPT += $(OPT_PRO))
|
||||
make arm-lto OPT="$(OPT)"
|
||||
|
||||
linux:
|
||||
$(CC) $(LINUX_INCLUDES) $(SOURCES) $(LPEG_SRC) $(GIF_SRC) $(SOURCES_EXT) $(TIC80_SRC) $(OPT) $(INCLUDES) $(LINUX_LIBS) $(LINUX_LINKER_FLAGS) -o bin/tic
|
||||
|
||||
linux-pro:
|
||||
$(eval OPT += $(OPT_PRO))
|
||||
make linux OPT="$(OPT)"
|
||||
|
||||
macosx:
|
||||
$(CC) $(SOURCES) $(TIC80_SRC) $(SOURCES_EXT) src/ext/file_dialog.m $(OPT) $(MACOSX_OPT) $(INCLUDES) $(MACOSX_LIBS) -o bin/tic
|
||||
|
||||
macosx-pro:
|
||||
$(eval OPT += $(OPT_PRO))
|
||||
make macosx OPT="$(OPT)"
|
||||
|
||||
bin/res.o: lib/mingw/res.rc lib/mingw/icon.ico
|
||||
windres $< $@
|
||||
|
||||
|
|
|
@ -83,6 +83,7 @@ static void drawCode(Code* code, bool withCursor)
|
|||
|
||||
if(code->cursor.selection && pointer >= selection.start && pointer < selection.end)
|
||||
code->tic->api.rect(code->tic, x-1, y-1, TIC_FONT_WIDTH+1, TIC_FONT_HEIGHT+1, getConfig()->theme.code.select);
|
||||
else code->tic->api.draw_char(code->tic, symbol, x+1, y+1, 0);
|
||||
|
||||
code->tic->api.draw_char(code->tic, symbol, x, y, *colorPointer);
|
||||
|
||||
|
|
28
src/tic.c
28
src/tic.c
|
@ -1648,27 +1648,21 @@ static void api_blit(tic_mem* tic, u32* out, tic_scanline scanline)
|
|||
|
||||
memset4(&out[0 * TIC80_FULLWIDTH], pal[tic->ram.vram.vars.border], TIC80_FULLWIDTH*Top);
|
||||
|
||||
for(s32 r = 0; r < TIC80_HEIGHT; r++)
|
||||
u32* rowPtr = out + Top*TIC80_FULLWIDTH;
|
||||
|
||||
for(s32 r = 0, y = tic->ram.vram.vars.offset.y; r < TIC80_HEIGHT; r++, y++, rowPtr += TIC80_FULLWIDTH)
|
||||
{
|
||||
memset4(&out[(r+Top) * TIC80_FULLWIDTH], pal[tic->ram.vram.vars.border], Left);
|
||||
memset4(&out[(r+Top) * TIC80_FULLWIDTH + Left], pal[tic->ram.vram.vars.bg], TIC80_WIDTH);
|
||||
memset4(rowPtr, pal[tic->ram.vram.vars.border], Left);
|
||||
memset4(rowPtr + Left, pal[tic->ram.vram.vars.bg], TIC80_WIDTH);
|
||||
|
||||
{
|
||||
s32 y = r + tic->ram.vram.vars.offset.y;
|
||||
u32* colPtr = rowPtr + Left;
|
||||
|
||||
if(y < 0 || y >= TIC80_HEIGHT) continue;
|
||||
|
||||
for(s32 c = 0; c < TIC80_WIDTH; c++)
|
||||
{
|
||||
s32 x = c + tic->ram.vram.vars.offset.x;
|
||||
if(y >= 0 && y < TIC80_HEIGHT)
|
||||
for(s32 c = 0, x = tic->ram.vram.vars.offset.x, index = y * TIC80_WIDTH + x; c < TIC80_WIDTH; c++, colPtr++, x++, index++)
|
||||
if(x >= 0 && x < TIC80_WIDTH)
|
||||
*colPtr = pal[tic_tool_peek4(tic->ram.vram.screen.data, index)];
|
||||
|
||||
if(x < 0 || x >= TIC80_WIDTH) continue;
|
||||
|
||||
out[(c + Left) + (r+Top) * TIC80_FULLWIDTH] = pal[tic_tool_peek4(tic->ram.vram.screen.data, x + y * TIC80_WIDTH)];
|
||||
}
|
||||
}
|
||||
|
||||
memset4(&out[(r+Top) * TIC80_FULLWIDTH + (TIC80_FULLWIDTH-Right)], pal[tic->ram.vram.vars.border], Right);
|
||||
memset4(rowPtr + (TIC80_FULLWIDTH-Right), pal[tic->ram.vram.vars.border], Right);
|
||||
|
||||
if(scanline && (r < TIC80_HEIGHT-1))
|
||||
{
|
||||
|
|
24
src/tools.c
24
src/tools.c
|
@ -25,28 +25,8 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
void tic_tool_poke4(void* addr, u32 index, u8 value)
|
||||
{
|
||||
u8* val = (u8*)addr + (index >> 1);
|
||||
|
||||
if(index & 1)
|
||||
{
|
||||
*val &= 0x0f;
|
||||
*val |= (value << 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
*val &= 0xf0;
|
||||
*val |= value & 0x0f;
|
||||
}
|
||||
}
|
||||
|
||||
u8 tic_tool_peek4(const void* addr, u32 index)
|
||||
{
|
||||
u8 val = ((u8*)addr)[index >> 1];
|
||||
|
||||
return index & 1 ? val >> 4 : val & 0xf;
|
||||
}
|
||||
extern void tic_tool_poke4(void* addr, u32 index, u8 value);
|
||||
extern u8 tic_tool_peek4(const void* addr, u32 index);
|
||||
|
||||
s32 tic_tool_get_pattern_id(const tic_track* track, s32 frame, s32 channel)
|
||||
{
|
||||
|
|
25
src/tools.h
25
src/tools.h
|
@ -24,8 +24,29 @@
|
|||
|
||||
#include "tic.h"
|
||||
|
||||
void tic_tool_poke4(void* addr, u32 index, u8 value);
|
||||
u8 tic_tool_peek4(const void* addr, u32 index);
|
||||
inline void tic_tool_poke4(void* addr, u32 index, u8 value)
|
||||
{
|
||||
u8* val = (u8*)addr + (index >> 1);
|
||||
|
||||
if(index & 1)
|
||||
{
|
||||
*val &= 0x0f;
|
||||
*val |= (value << 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
*val &= 0xf0;
|
||||
*val |= value & 0x0f;
|
||||
}
|
||||
}
|
||||
|
||||
inline u8 tic_tool_peek4(const void* addr, u32 index)
|
||||
{
|
||||
u8 val = ((u8*)addr)[index >> 1];
|
||||
|
||||
return index & 1 ? val >> 4 : val & 0xf;
|
||||
}
|
||||
|
||||
bool tic_tool_parse_note(const char* noteStr, s32* note, s32* octave);
|
||||
s32 tic_tool_get_pattern_id(const tic_track* track, s32 frame, s32 channel);
|
||||
void tic_tool_set_pattern_id(tic_track* track, s32 frame, s32 channel, s32 id);
|
||||
|
|
Loading…
Reference in New Issue