Update scripts and NES compatibility, add PNG to NES CHR convert

This commit is contained in:
2023-11-01 23:22:11 +01:00
parent 9be90d7629
commit fa7bc447fc
14 changed files with 379 additions and 28 deletions

View File

@ -51,12 +51,8 @@ else ifeq ($(MultiSpacc_Target), NES)
endif
CC = $(ToolsPrefix)gcc $(CFlags) $(Defines)
Shell = $(shell echo $$SHELL)
AppObjects = $(AppSources:.c=.o)
SpaccObjects = $(SpaccSources:.c=.o)
BuildObjects = $(AppObjects) $(SpaccObjects)
#BuildSources = $(AppSources) $(SpaccSources)
#Objects = $(BuildSources:.c=.o)
BuildSources = $(AppSources) $(SpaccSources)
BuildObjects = $(BuildSources:.c=.o)
All all: $(BuildProcess)
@ -73,9 +69,9 @@ __NDS__:
cp $(SpaccSources) $(SpaccHeaders) $(VirtualBuildDir)/source/.tmp/
cd $(VirtualBuildDir)/source/.tmp; for i in *; do mv ./$$i ../LibMultiSpacc_$$i; done
cp $(AppSources) $(AppHeaders) $(VirtualBuildDir)/source/
for i in $(VirtualBuildDir)/source/*; do sed -i 's|#include[ \t]"../../LibMultiSpacc/|#include "LibMultiSpacc_|g' $$i; done
for i in $(VirtualBuildDir)/source/*; do sed -i 's|#include[ \t]"../MultiSpacc|#include "LibMultiSpacc_MultiSpacc|g' $$i; done
for i in $(VirtualBuildDir)/source/*; do sed -i 's|#include[ \t]"./|#include "./LibMultiSpacc_|g' $$i; done
for i in $(VirtualBuildDir)/source/*.c $(VirtualBuildDir)/source/*.h; do sed -i 's|#include[ \t]"../../LibMultiSpacc/|#include "LibMultiSpacc_|g' $$i; done
for i in $(VirtualBuildDir)/source/*.c $(VirtualBuildDir)/source/*.h; do sed -i 's|#include[ \t]"../MultiSpacc|#include "LibMultiSpacc_MultiSpacc|g' $$i; done
for i in $(VirtualBuildDir)/source/*.c $(VirtualBuildDir)/source/*.h; do sed -i 's|#include[ \t]"./|#include "LibMultiSpacc_|g' $$i; done
cd $(VirtualBuildDir); make
__NES__:
@ -85,13 +81,14 @@ __NES__:
cp $(SpaccSources) $(SpaccHeaders) $(VirtualBuildDir)/.tmp/
cd $(VirtualBuildDir)/.tmp; for i in *; do mv ./$$i ../LibMultiSpacc_$$i; done
cp $(AppSources) $(AppHeaders) $(VirtualBuildDir)/
for i in $(VirtualBuildDir)/*; do sed -i 's|#include[ \t]"../../LibMultiSpacc/|#include "LibMultiSpacc_|g' $$i; done
for i in $(VirtualBuildDir)/*; do sed -i 's|#include[ \t]"../MultiSpacc|#include "LibMultiSpacc_MultiSpacc|g' $$i; done
for i in $(VirtualBuildDir)/*; do sed -i 's|#include[ \t]"./|#include "./LibMultiSpacc_|g' $$i; done
cp ../../neslib/*.cfg ../../neslib/crt0.o ../../neslib/chr_generic.o ../../neslib/*.lib ../../neslib/*.h $(VirtualBuildDir)/
echo "AppName='$(AppName)'; Defines='$(Defines)'; AppSources='$(AppSources)'; SpaccSources='$(SpaccSources)'; AppObjects='$(AppObjects)'; BuildObjects='$(BuildObjects)';" > $(VirtualBuildDir)/Make.sh
for i in $(VirtualBuildDir)/*.c $(VirtualBuildDir)/*.h; do sed -i 's|#include[ \t]"../../LibMultiSpacc/|#include "LibMultiSpacc_|g' $$i; done
for i in $(VirtualBuildDir)/*.c $(VirtualBuildDir)/*.h; do sed -i 's|#include[ \t]"../MultiSpacc|#include "LibMultiSpacc_MultiSpacc|g' $$i; done
for i in $(VirtualBuildDir)/*.c $(VirtualBuildDir)/*.h; do sed -i 's|#include[ \t]"./|#include "LibMultiSpacc_|g' $$i; done
cp ../../neslib/*.cfg ../../neslib/crt0.o ../../neslib/*.lib ../../neslib/*.h $(VirtualBuildDir)/
printf ".segment \"CHARS\"\n\t.incbin \"CHARS.chr\"" > $(VirtualBuildDir)/CHARS.s
echo "AppName='$(AppName)'; Defines='$(Defines)'; ProjectRoot=../..;" > $(VirtualBuildDir)/Make.sh
cat ../NES.mk.sh >> $(VirtualBuildDir)/Make.sh
cd $(VirtualBuildDir); $(Shell) ./Make.sh
cd $(VirtualBuildDir); sh ./Make.sh
Run run: All
./$(AppName)$(ExeSuffix)

Binary file not shown.

After

Width:  |  Height:  |  Size: 773 B

View File

@ -27,7 +27,7 @@ int main( int argc, char *argv[] )
MultiSpacc_Surface *Screen;
MultiSpacc_Surface *TilesImg;
WindowConfig.Width = 256;
WindowConfig.Width = 320;
WindowConfig.Height = 240;
WindowConfig.Bits = 16;
memcpy( WindowConfig.Palette, PALETTE, 32 );
@ -45,13 +45,13 @@ int main( int argc, char *argv[] )
// Bitmap font borrowed from: <https://github.com/nesdoug/01_Hello/blob/master/Alpha.chr>
// Copyright (c) 2018 Doug Fraker www.nesdoug.com (MIT)
//TilesImg = MultiSpacc_LoadImage( "Tiles.png", Screen, NULL );
TilesImg = MultiSpacc_LoadImage( "CHARS.png", Screen, NULL );
MultiSpacc_PrintText( "Hello, World!", Screen, &WindowConfig, 2, 2, TilesImg );
MultiSpacc_PrintDebug("[I] Ready!\n");
while(true)
{
MultiSpacc_Sprite( 0, spriteX, spriteY, 20/*128*/, TilesImg, Screen );
MultiSpacc_Sprite( 0, spriteX, spriteY, 1, TilesImg, Screen );
//scroll(spriteX,0);
spriteX += accelX;
@ -74,7 +74,7 @@ int main( int argc, char *argv[] )
};
// TODO: Implement cross-platform vblank-wait
//MultiSpacc_Sleep(16);
MultiSpacc_Sleep(16);
}
return 0;

View File

@ -1 +1 @@
include ../Common.mk
include ../Common.mk

Binary file not shown.

Before

Width:  |  Height:  |  Size: 664 B

View File

@ -1,7 +1,8 @@
#!/dev/null
set -e
SdkRoot="${ProjectRoot}/../../.."
# ${SpaccSources} ${AppSources} ${SpaccObjects} ${AppObjects} chr_generic.s chr_generic.o crt0.o
sh "${SdkRoot}/Tools/python3.sh" "${SdkRoot}/Tools/pilbmp2nes.py" -i "${ProjectRoot}/CHARS.png" -o ./CHARS.chr
for File in *.c
do cc65 -Oirs --target nes ${File} ${Defines}