studio works as dll now
This commit is contained in:
parent
39dfdcfc4f
commit
39db956c0d
|
@ -102,3 +102,7 @@ build/uwp/wren/x64/
|
|||
build/uwp/wren/Release/
|
||||
build/uwp/wren/ARM/
|
||||
build/uwp/wren/Debug/
|
||||
build/windows/studio/Debug/
|
||||
build/windows/studio/Debug Pro/
|
||||
build/windows/studio/Release/
|
||||
build/windows/studio/Release Pro/
|
||||
|
|
23
Makefile
23
Makefile
|
@ -251,6 +251,12 @@ bin/surf.o: src/surf.c $(TIC80_H) $(TIC_H)
|
|||
bin/main.o: src/main.c src/keycodes.c $(TIC80_H) $(TIC_H)
|
||||
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
|
||||
|
||||
SDL_NET = \
|
||||
bin/SDLnet.o \
|
||||
bin/SDLnetTCP.o \
|
||||
bin/SDLnetselect.o \
|
||||
bin/net.o
|
||||
|
||||
TIC_O=\
|
||||
bin/studio.o \
|
||||
bin/console.o \
|
||||
|
@ -258,9 +264,6 @@ TIC_O=\
|
|||
bin/file_dialog.o \
|
||||
bin/md5.o \
|
||||
bin/gif.o \
|
||||
bin/SDLnet.o \
|
||||
bin/SDLnetTCP.o \
|
||||
bin/SDLnetselect.o \
|
||||
bin/fs.o \
|
||||
bin/tools.o \
|
||||
bin/start.o \
|
||||
|
@ -272,11 +275,9 @@ TIC_O=\
|
|||
bin/world.o \
|
||||
bin/config.o \
|
||||
bin/code.o \
|
||||
bin/net.o \
|
||||
bin/dialog.o \
|
||||
bin/menu.o \
|
||||
bin/surf.o \
|
||||
bin/main.o
|
||||
bin/surf.o
|
||||
|
||||
bin/tic80.o: src/tic80.c $(TIC80_H)
|
||||
$(CC) $< $(OPT) $(INCLUDES) -DTIC80_SHARED -c -o $@
|
||||
|
@ -304,17 +305,23 @@ TIC80_O = bin/tic80.o bin/tic.o bin/tools.o bin/blip_buf.o bin/jsapi.o bin/luaap
|
|||
TIC80_A = bin/libtic80.a
|
||||
TIC80_DLL = bin/tic80.dll
|
||||
|
||||
STUDIO_A = bin/libstudio.a
|
||||
STUDIO_DLL = bin/studio.dll
|
||||
|
||||
$(TIC80_DLL): $(TIC80_O)
|
||||
$(CC) $(OPT) -shared $(TIC80_O) -L$(PRE_BUILT)/mingw -llua -lwren -lgif -Wl,--out-implib,$(TIC80_A) -o $@
|
||||
|
||||
$(STUDIO_DLL): $(DEMO_ASSETS) $(TIC80_DLL) $(TIC_O) bin/html.o
|
||||
$(CC) $(TIC_O) bin/html.o $(TIC80_A) $(OPT) -shared $(INCLUDES) -L$(PRE_BUILT)/mingw -llua -lz -lgif -Wl,--out-implib,$(STUDIO_A) -o $@
|
||||
|
||||
emscripten:
|
||||
$(EMS_CC) $(SOURCES) $(TIC80_SRC) $(OPT) $(INCLUDES) $(EMS_OPT) $(EMS_LINKER_FLAGS) -o build/html/tic.js
|
||||
|
||||
wasm:
|
||||
$(EMS_CC) $(SOURCES) $(TIC80_SRC) $(OPT) $(INCLUDES) $(EMS_OPT) -s WASM=1 $(EMS_LINKER_FLAGS) -o build/html/tic.js
|
||||
|
||||
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: $(STUDIO_DLL) $(SDL_NET) bin/main.o bin/res.o
|
||||
$(CC) bin/main.o bin/res.o $(STUDIO_A) $(SDL_NET) $(OPT) $(INCLUDES) $(MINGW_LINKER_FLAGS) -o $(MINGW_OUTPUT)
|
||||
|
||||
mingw-pro:
|
||||
$(eval OPT += $(OPT_PRO))
|
||||
|
|
|
@ -0,0 +1,318 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug Pro|Win32">
|
||||
<Configuration>Debug Pro</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug Pro|x64">
|
||||
<Configuration>Debug Pro</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release Pro|Win32">
|
||||
<Configuration>Release Pro</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release Pro|x64">
|
||||
<Configuration>Release Pro</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>studio</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Pro|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Pro|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Pro|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Pro|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Pro|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Pro|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Pro|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Pro|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Pro|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Pro|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Pro|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Pro|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>TIC80_SHARED;WIN32;_DEBUG;_WINDOWS;_USRDLL;STUDIO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\wren-0.1.0\src\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Pro|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>TIC80_SHARED;WIN32;_DEBUG;_WINDOWS;_USRDLL;STUDIO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\wren-0.1.0\src\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>TIC80_SHARED;_DEBUG;_WINDOWS;_USRDLL;STUDIO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\wren-0.1.0\src\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Pro|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>TIC80_SHARED;_DEBUG;_WINDOWS;_USRDLL;STUDIO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\wren-0.1.0\src\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>TIC80_SHARED;WIN32;NDEBUG;_WINDOWS;_USRDLL;STUDIO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\wren-0.1.0\src\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Pro|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>TIC80_SHARED;WIN32;NDEBUG;_WINDOWS;_USRDLL;STUDIO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\wren-0.1.0\src\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>TIC80_SHARED;NDEBUG;_WINDOWS;_USRDLL;STUDIO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\wren-0.1.0\src\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Pro|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>TIC80_SHARED;NDEBUG;_WINDOWS;_USRDLL;STUDIO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\wren-0.1.0\src\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\src\code.c" />
|
||||
<ClCompile Include="..\..\..\src\config.c" />
|
||||
<ClCompile Include="..\..\..\src\console.c" />
|
||||
<ClCompile Include="..\..\..\src\dialog.c" />
|
||||
<ClCompile Include="..\..\..\src\ext\file_dialog.c" />
|
||||
<ClCompile Include="..\..\..\src\ext\gif.c" />
|
||||
<ClCompile Include="..\..\..\src\ext\md5.c" />
|
||||
<ClCompile Include="..\..\..\src\fs.c" />
|
||||
<ClCompile Include="..\..\..\src\history.c" />
|
||||
<ClCompile Include="..\..\..\src\html.c" />
|
||||
<ClCompile Include="..\..\..\src\map.c" />
|
||||
<ClCompile Include="..\..\..\src\menu.c" />
|
||||
<ClCompile Include="..\..\..\src\music.c" />
|
||||
<ClCompile Include="..\..\..\src\run.c" />
|
||||
<ClCompile Include="..\..\..\src\sfx.c" />
|
||||
<ClCompile Include="..\..\..\src\sprite.c" />
|
||||
<ClCompile Include="..\..\..\src\start.c" />
|
||||
<ClCompile Include="..\..\..\src\studio.c" />
|
||||
<ClCompile Include="..\..\..\src\surf.c" />
|
||||
<ClCompile Include="..\..\..\src\tools.c" />
|
||||
<ClCompile Include="..\..\..\src\world.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\gif\gif.vcxproj">
|
||||
<Project>{6ea9d998-7557-4aed-abfc-142f9960c9b6}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\lua\lua.vcxproj">
|
||||
<Project>{57d2471b-3138-495e-af18-6e290d098ffc}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\tic80\tic80.vcxproj">
|
||||
<Project>{c4d8bc10-ebf6-42bb-9b5d-6712fb428a50}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\zlib\zlib.vcxproj">
|
||||
<Project>{1dfbdfa2-f204-42ff-b99e-250e4b2eba04}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -0,0 +1,76 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="src">
|
||||
<UniqueIdentifier>{6c183603-0dc2-4093-91e5-1aba3b2b5d08}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="src\ext">
|
||||
<UniqueIdentifier>{1410c434-08eb-4b70-a278-14955c0ecb28}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\src\code.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\config.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\console.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\dialog.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\fs.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\history.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\html.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\map.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\menu.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\music.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\run.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\sfx.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\sprite.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\start.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\studio.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\surf.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\tools.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\world.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\ext\file_dialog.c">
|
||||
<Filter>src\ext</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\ext\md5.c">
|
||||
<Filter>src\ext</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\ext\gif.c">
|
||||
<Filter>src\ext</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27130.2024
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tic", "tic.vcxproj", "{B6ECC66E-26FA-42C2-8F6C-E4338424F38A}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
|
@ -27,6 +27,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2main", "..\..\..\3rd-pa
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wren_lib", "..\wren\wren_lib.vcxproj", "{D7CC5189-C399-AC94-ECB2-9A3CD8DEE122}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "studio", "..\studio\studio.vcxproj", "{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug Pro|x64 = Debug Pro|x64
|
||||
|
@ -183,6 +185,22 @@ Global
|
|||
{D7CC5189-C399-AC94-ECB2-9A3CD8DEE122}.Release|x64.Build.0 = Release|x64
|
||||
{D7CC5189-C399-AC94-ECB2-9A3CD8DEE122}.Release|x86.ActiveCfg = Release|Win32
|
||||
{D7CC5189-C399-AC94-ECB2-9A3CD8DEE122}.Release|x86.Build.0 = Release|Win32
|
||||
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Debug Pro|x64.ActiveCfg = Debug Pro|x64
|
||||
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Debug Pro|x64.Build.0 = Debug Pro|x64
|
||||
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Debug Pro|x86.ActiveCfg = Debug Pro|Win32
|
||||
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Debug Pro|x86.Build.0 = Debug Pro|Win32
|
||||
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Debug|x64.Build.0 = Debug|x64
|
||||
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Debug|x86.Build.0 = Debug|Win32
|
||||
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Release Pro|x64.ActiveCfg = Release Pro|x64
|
||||
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Release Pro|x64.Build.0 = Release Pro|x64
|
||||
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Release Pro|x86.ActiveCfg = Release Pro|Win32
|
||||
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Release Pro|x86.Build.0 = Release Pro|Win32
|
||||
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Release|x64.ActiveCfg = Release|x64
|
||||
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Release|x64.Build.0 = Release|x64
|
||||
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Release|x86.ActiveCfg = Release|Win32
|
||||
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -41,46 +41,19 @@
|
|||
<ProjectReference Include="..\..\..\3rd-party\SDL2-2.0.7\VisualC\SDL\SDL.vcxproj">
|
||||
<Project>{81ce8daf-ebb2-4761-8e45-b71abcca8c68}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\gif\gif.vcxproj">
|
||||
<Project>{6ea9d998-7557-4aed-abfc-142f9960c9b6}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\lua\lua.vcxproj">
|
||||
<Project>{57d2471b-3138-495e-af18-6e290d098ffc}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\tic80\tic80.vcxproj">
|
||||
<Project>{c4d8bc10-ebf6-42bb-9b5d-6712fb428a50}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\zlib\zlib.vcxproj">
|
||||
<Project>{1dfbdfa2-f204-42ff-b99e-250e4b2eba04}</Project>
|
||||
<ProjectReference Include="..\studio\studio.vcxproj">
|
||||
<Project>{6181f6a6-aa1b-4cd2-b306-e242cfde9b20}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\3rd-party\SDL2_net-2.0.1\SDLnet.c" />
|
||||
<ClCompile Include="..\..\..\3rd-party\SDL2_net-2.0.1\SDLnetselect.c" />
|
||||
<ClCompile Include="..\..\..\3rd-party\SDL2_net-2.0.1\SDLnetTCP.c" />
|
||||
<ClCompile Include="..\..\..\src\code.c" />
|
||||
<ClCompile Include="..\..\..\src\config.c" />
|
||||
<ClCompile Include="..\..\..\src\console.c" />
|
||||
<ClCompile Include="..\..\..\src\dialog.c" />
|
||||
<ClCompile Include="..\..\..\src\ext\file_dialog.c" />
|
||||
<ClCompile Include="..\..\..\src\ext\gif.c" />
|
||||
<ClCompile Include="..\..\..\src\ext\md5.c" />
|
||||
<ClCompile Include="..\..\..\src\fs.c" />
|
||||
<ClCompile Include="..\..\..\src\history.c" />
|
||||
<ClCompile Include="..\..\..\src\html.c" />
|
||||
<ClCompile Include="..\..\..\src\main.c" />
|
||||
<ClCompile Include="..\..\..\src\map.c" />
|
||||
<ClCompile Include="..\..\..\src\menu.c" />
|
||||
<ClCompile Include="..\..\..\src\music.c" />
|
||||
<ClCompile Include="..\..\..\src\net.c" />
|
||||
<ClCompile Include="..\..\..\src\run.c" />
|
||||
<ClCompile Include="..\..\..\src\sfx.c" />
|
||||
<ClCompile Include="..\..\..\src\sprite.c" />
|
||||
<ClCompile Include="..\..\..\src\start.c" />
|
||||
<ClCompile Include="..\..\..\src\studio.c" />
|
||||
<ClCompile Include="..\..\..\src\surf.c" />
|
||||
<ClCompile Include="..\..\..\src\tools.c" />
|
||||
<ClCompile Include="..\..\..\src\world.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="icon.ico" />
|
||||
|
|
|
@ -15,72 +15,6 @@
|
|||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\src\console.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\fs.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\history.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\map.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\music.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\run.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\sfx.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\sprite.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\start.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\studio.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\world.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\ext\file_dialog.c">
|
||||
<Filter>src\ext</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\ext\md5.c">
|
||||
<Filter>src\ext</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\html.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\code.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\config.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\ext\gif.c">
|
||||
<Filter>src\ext</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\net.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\tools.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\dialog.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\menu.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\surf.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\3rd-party\SDL2_net-2.0.1\SDLnet.c">
|
||||
<Filter>src\ext\net</Filter>
|
||||
</ClCompile>
|
||||
|
@ -93,6 +27,9 @@
|
|||
<ClCompile Include="..\..\..\src\main.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\net.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="icon.ico">
|
||||
|
|
130
src/fs.c
130
src/fs.c
|
@ -105,8 +105,28 @@ bool fsIsInPublicDir(FileSystem* fs)
|
|||
|
||||
#if defined(__TIC_WINDOWS__) || defined(__WINRT__)
|
||||
|
||||
#define UTF8ToString(S) (wchar_t *)SDL_iconv_string("UTF-16LE", "UTF-8", (char *)(S), SDL_strlen(S)+1)
|
||||
#define StringToUTF8(S) SDL_iconv_string("UTF-8", "UTF-16LE", (char *)(S), (SDL_wcslen(S)+1)*sizeof(wchar_t))
|
||||
// #define UTF8ToString(S) (wchar_t *)SDL_iconv_string("UTF-16LE", "UTF-8", (char *)(S), strlen(S)+1)
|
||||
// #define StringToUTF8(S) SDL_iconv_string("UTF-8", "UTF-16LE", (char *)(S), (wcslen(S)+1)*sizeof(wchar_t))
|
||||
|
||||
static const wchar_t* UTF8ToString(const char* str)
|
||||
{
|
||||
// TODO: ugly hack
|
||||
wchar_t* wstr = calloc(1, FILENAME_MAX * sizeof(wchar_t));
|
||||
|
||||
mbstowcs(wstr, str, FILENAME_MAX);
|
||||
|
||||
return wstr;
|
||||
}
|
||||
|
||||
static char* StringToUTF8(const wchar_t* wstr)
|
||||
{
|
||||
// TODO: ugly hack
|
||||
char* str = calloc(1, FILENAME_MAX);
|
||||
|
||||
wcstombs(str, wstr, FILENAME_MAX);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
FILE* _wfopen(const wchar_t *, const wchar_t *);
|
||||
int _wremove(const wchar_t *);
|
||||
|
@ -154,7 +174,7 @@ void fsEnumFiles(FileSystem* fs, ListCallback callback, void* data)
|
|||
|
||||
if(isPublic(fs))
|
||||
{
|
||||
netDirRequest(fs->net, fs->work + sizeof(TIC_HOST), callback, data);
|
||||
_netDirRequest(fs->net, fs->work + sizeof(TIC_HOST), callback, data);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -701,7 +721,7 @@ void* fsLoadFile(FileSystem* fs, const char* name, s32* size)
|
|||
|
||||
char path[FILENAME_MAX] = {0};
|
||||
sprintf(path, "/cart/%s/cart.tic", loadPublicCartData.hash);
|
||||
void* data = netGetRequest(fs->net, path, size);
|
||||
void* data = _netGetRequest(fs->net, path, size);
|
||||
|
||||
if(data)
|
||||
fsSaveRootFile(fs, cachePath, data, *size, false);
|
||||
|
@ -798,59 +818,57 @@ void createFileSystem(const char* path, void(*callback)(FileSystem*))
|
|||
FileSystem* fs = (FileSystem*)malloc(sizeof(FileSystem));
|
||||
memset(fs, 0, sizeof(FileSystem));
|
||||
|
||||
fs->net = createNet();
|
||||
fs->net = _createNet();
|
||||
|
||||
if(path)
|
||||
{
|
||||
strcpy(fs->dir, path);
|
||||
callback(fs);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
|
||||
strcpy(fs->dir, "/" TIC_PACKAGE "/" TIC_NAME "/");
|
||||
|
||||
#elif defined(__ANDROID__)
|
||||
|
||||
strcpy(fs->dir, SDL_AndroidGetExternalStoragePath());
|
||||
const char AppFolder[] = "/" TIC_NAME "/";
|
||||
strcat(fs->dir, AppFolder);
|
||||
mkdir(fs->dir, 0700);
|
||||
|
||||
#else
|
||||
|
||||
char* path = SDL_GetPrefPath(TIC_PACKAGE, TIC_NAME);
|
||||
strcpy(fs->dir, path);
|
||||
free(path);
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
EM_ASM_
|
||||
(
|
||||
{
|
||||
var dir = "";
|
||||
Module.Pointer_stringify($0).split("/").forEach(function(val)
|
||||
{
|
||||
if(val.length)
|
||||
{
|
||||
dir += "/" + val;
|
||||
FS.mkdir(dir);
|
||||
}
|
||||
});
|
||||
|
||||
FS.mount(IDBFS, {}, dir);
|
||||
FS.syncfs(true, function(error)
|
||||
{
|
||||
if(error) console.log(error);
|
||||
else Runtime.dynCall('vi', $1, [$2]);
|
||||
});
|
||||
}, fs->dir, callback, fs
|
||||
);
|
||||
#else
|
||||
callback(fs);
|
||||
#endif
|
||||
}
|
||||
|
||||
// else
|
||||
// {
|
||||
|
||||
// #if defined(__EMSCRIPTEN__)
|
||||
|
||||
// strcpy(fs->dir, "/" TIC_PACKAGE "/" TIC_NAME "/");
|
||||
|
||||
// #elif defined(__ANDROID__)
|
||||
|
||||
// strcpy(fs->dir, SDL_AndroidGetExternalStoragePath());
|
||||
// const char AppFolder[] = "/" TIC_NAME "/";
|
||||
// strcat(fs->dir, AppFolder);
|
||||
// mkdir(fs->dir, 0700);
|
||||
|
||||
// #else
|
||||
|
||||
// char* path = SDL_GetPrefPath(TIC_PACKAGE, TIC_NAME);
|
||||
// strcpy(fs->dir, path);
|
||||
// free(path);
|
||||
|
||||
// #endif
|
||||
|
||||
// #if defined(__EMSCRIPTEN__)
|
||||
// EM_ASM_
|
||||
// (
|
||||
// {
|
||||
// var dir = "";
|
||||
// Module.Pointer_stringify($0).split("/").forEach(function(val)
|
||||
// {
|
||||
// if(val.length)
|
||||
// {
|
||||
// dir += "/" + val;
|
||||
// FS.mkdir(dir);
|
||||
// }
|
||||
// });
|
||||
|
||||
// FS.mount(IDBFS, {}, dir);
|
||||
// FS.syncfs(true, function(error)
|
||||
// {
|
||||
// if(error) console.log(error);
|
||||
// else Runtime.dynCall('vi', $1, [$2]);
|
||||
// });
|
||||
// }, fs->dir, callback, fs
|
||||
// );
|
||||
// #else
|
||||
// callback(fs);
|
||||
// #endif
|
||||
// }
|
||||
}
|
127
src/main.c
127
src/main.c
|
@ -1,6 +1,6 @@
|
|||
#include "main.h"
|
||||
#include "studio.h"
|
||||
|
||||
#include "net.h"
|
||||
#include <SDL.h>
|
||||
|
||||
#define STUDIO_UI_SCALE 3
|
||||
|
@ -814,6 +814,98 @@ static void tick()
|
|||
blitSound();
|
||||
}
|
||||
|
||||
// should work async with callback
|
||||
static const char* getAppFolder()
|
||||
{
|
||||
|
||||
static char appFolder[FILENAME_MAX];
|
||||
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
|
||||
strcpy(appFolder, "/" TIC_PACKAGE "/" TIC_NAME "/");
|
||||
|
||||
#elif defined(__ANDROID__)
|
||||
|
||||
strcpy(appFolder, SDL_AndroidGetExternalStoragePath());
|
||||
const char AppFolder[] = "/" TIC_NAME "/";
|
||||
strcat(appFolder, AppFolder);
|
||||
mkdir(appFolder, 0700);
|
||||
|
||||
#else
|
||||
|
||||
char* path = SDL_GetPrefPath(TIC_PACKAGE, TIC_NAME);
|
||||
strcpy(appFolder, path);
|
||||
free(path);
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
EM_ASM_
|
||||
(
|
||||
{
|
||||
var dir = "";
|
||||
Module.Pointer_stringify($0).split("/").forEach(function(val)
|
||||
{
|
||||
if(val.length)
|
||||
{
|
||||
dir += "/" + val;
|
||||
FS.mkdir(dir);
|
||||
}
|
||||
});
|
||||
|
||||
FS.mount(IDBFS, {}, dir);
|
||||
FS.syncfs(true, function(error)
|
||||
{
|
||||
if(error) console.log(error);
|
||||
else Runtime.dynCall('vi', $1, [$2]);
|
||||
});
|
||||
}, appFolder, callback, fs
|
||||
);
|
||||
#endif
|
||||
|
||||
return appFolder;
|
||||
}
|
||||
|
||||
void setClipboardText(const char* text)
|
||||
{
|
||||
SDL_SetClipboardText(text);
|
||||
}
|
||||
|
||||
bool hasClipboardText()
|
||||
{
|
||||
return SDL_HasClipboardText();
|
||||
}
|
||||
|
||||
char* getClipboardText()
|
||||
{
|
||||
return SDL_GetClipboardText();
|
||||
}
|
||||
|
||||
u64 getPerformanceCounter()
|
||||
{
|
||||
return SDL_GetPerformanceCounter();
|
||||
}
|
||||
|
||||
u64 getPerformanceFrequency()
|
||||
{
|
||||
return SDL_GetPerformanceFrequency();
|
||||
}
|
||||
|
||||
static System sysHandlers =
|
||||
{
|
||||
.setClipboardText = setClipboardText,
|
||||
.hasClipboardText = hasClipboardText,
|
||||
.getClipboardText = getClipboardText,
|
||||
.getPerformanceCounter = getPerformanceCounter,
|
||||
.getPerformanceFrequency = getPerformanceFrequency,
|
||||
|
||||
.netVersionRequest = netVersionRequest,
|
||||
.netDirRequest = netDirRequest,
|
||||
.netGetRequest = netGetRequest,
|
||||
.createNet = createNet,
|
||||
.closeNet = closeNet,
|
||||
};
|
||||
|
||||
s32 main(s32 argc, char **argv)
|
||||
{
|
||||
SDL_SetHint(SDL_HINT_WINRT_HANDLE_BACK_BUTTON, "1");
|
||||
|
@ -841,14 +933,14 @@ s32 main(s32 argc, char **argv)
|
|||
#elif defined(__EMSCRIPTEN__)
|
||||
SDL_RENDERER_ACCELERATED
|
||||
#else
|
||||
// TODO: uncomment this later
|
||||
// TODO: uncomment this later, also init FS before read config
|
||||
SDL_RENDERER_ACCELERATED// | (getConfig()->useVsync ? SDL_RENDERER_PRESENTVSYNC : 0)
|
||||
#endif
|
||||
);
|
||||
|
||||
platform.texture = SDL_CreateTexture(platform.renderer, STUDIO_PIXEL_FORMAT, SDL_TEXTUREACCESS_STREAMING, TEXTURE_SIZE, TEXTURE_SIZE);
|
||||
|
||||
platform.studio = studioInit(argc, argv, platform.audio.spec.freq);
|
||||
platform.studio = studioInit(argc, argv, platform.audio.spec.freq, getAppFolder(), &sysHandlers);
|
||||
|
||||
initTouchGamepad();
|
||||
|
||||
|
@ -902,32 +994,3 @@ s32 main(s32 argc, char **argv)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////
|
||||
|
||||
|
||||
void setClipboardText(const char* text)
|
||||
{
|
||||
SDL_SetClipboardText(text);
|
||||
}
|
||||
|
||||
bool hasClipboardText()
|
||||
{
|
||||
return SDL_HasClipboardText();
|
||||
}
|
||||
|
||||
char* getClipboardText()
|
||||
{
|
||||
return SDL_GetClipboardText();
|
||||
}
|
||||
|
||||
u64 getPerformanceCounter()
|
||||
{
|
||||
return SDL_GetPerformanceCounter();
|
||||
}
|
||||
|
||||
u64 getPerformanceFrequency()
|
||||
{
|
||||
return SDL_GetPerformanceFrequency();
|
||||
}
|
59
src/studio.c
59
src/studio.c
|
@ -88,6 +88,7 @@ static const EditorMode Modes[] =
|
|||
static struct
|
||||
{
|
||||
Studio studio;
|
||||
System* system;
|
||||
|
||||
tic80_local* tic80local;
|
||||
|
||||
|
@ -2927,13 +2928,15 @@ static void emstick()
|
|||
|
||||
#endif
|
||||
|
||||
Studio* studioInit(s32 argc, char **argv, s32 samplerate)
|
||||
Studio* studioInit(s32 argc, char **argv, s32 samplerate, const char* folder, System* system)
|
||||
{
|
||||
setbuf(stdout, NULL);
|
||||
studioImpl.argc = argc;
|
||||
studioImpl.argv = argv;
|
||||
studioImpl.samplerate = samplerate;
|
||||
|
||||
studioImpl.system = system;
|
||||
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
|
||||
if(studioImpl.argc == 2)
|
||||
|
@ -2946,7 +2949,7 @@ Studio* studioInit(s32 argc, char **argv, s32 samplerate)
|
|||
|
||||
#else
|
||||
|
||||
createFileSystem(argc > 1 && fsExists(argv[1]) ? fsBasename(argv[1]) : NULL, onFSInitialized);
|
||||
createFileSystem(argc > 1 && fsExists(argv[1]) ? fsBasename(argv[1]) : folder, onFSInitialized);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -3031,7 +3034,7 @@ void studioTick(void* pixels)
|
|||
|
||||
void studioClose()
|
||||
{
|
||||
closeNet(studioImpl.surf->net);
|
||||
_closeNet(studioImpl.surf->net);
|
||||
|
||||
{
|
||||
for(s32 i = 0; i < TIC_EDITOR_BANKS; i++)
|
||||
|
@ -3076,3 +3079,53 @@ void studioClose()
|
|||
|
||||
// exit(0);
|
||||
}
|
||||
|
||||
void setClipboardText(const char* text)
|
||||
{
|
||||
studioImpl.system->setClipboardText(text);
|
||||
}
|
||||
|
||||
bool hasClipboardText()
|
||||
{
|
||||
return studioImpl.system->hasClipboardText();
|
||||
}
|
||||
|
||||
char* getClipboardText()
|
||||
{
|
||||
return studioImpl.system->getClipboardText();
|
||||
}
|
||||
|
||||
u64 getPerformanceCounter()
|
||||
{
|
||||
return studioImpl.system->getPerformanceCounter();
|
||||
}
|
||||
|
||||
u64 getPerformanceFrequency()
|
||||
{
|
||||
return studioImpl.system->getPerformanceFrequency();
|
||||
}
|
||||
|
||||
NetVersion _netVersionRequest(Net* net)
|
||||
{
|
||||
return studioImpl.system->netVersionRequest(net);
|
||||
}
|
||||
|
||||
void _netDirRequest(Net* net, const char* path, ListCallback callback, void* data)
|
||||
{
|
||||
return studioImpl.system->netDirRequest(net, path, callback, data);
|
||||
}
|
||||
|
||||
void* _netGetRequest(Net* net, const char* path, s32* size)
|
||||
{
|
||||
return studioImpl.system->netGetRequest(net, path, size);
|
||||
}
|
||||
|
||||
Net* _createNet()
|
||||
{
|
||||
return studioImpl.system->createNet();
|
||||
}
|
||||
|
||||
void _closeNet(Net* net)
|
||||
{
|
||||
return studioImpl.system->closeNet(net);
|
||||
}
|
31
src/studio.h
31
src/studio.h
|
@ -37,6 +37,7 @@
|
|||
#include "ticapi.h"
|
||||
#include "defines.h"
|
||||
#include "tools.h"
|
||||
#include "net.h"
|
||||
|
||||
#define TIC_LOCAL ".local/"
|
||||
#define TIC_CACHE TIC_LOCAL "cache/"
|
||||
|
@ -187,7 +188,7 @@ void showTooltip(const char* text);
|
|||
|
||||
tic_key* getKeymap();
|
||||
|
||||
const StudioConfig* getConfig();
|
||||
TIC80_API const StudioConfig* getConfig();
|
||||
|
||||
void setSpritePixel(tic_tile* tiles, s32 x, s32 y, u8 color);
|
||||
u8 getSpritePixel(tic_tile* tiles, s32 x, s32 y);
|
||||
|
@ -217,9 +218,25 @@ typedef struct
|
|||
|
||||
} Studio;
|
||||
|
||||
Studio* studioInit(s32 argc, char **argv, s32 samplerate);
|
||||
void studioTick(void* pixels);
|
||||
void studioClose();
|
||||
typedef struct
|
||||
{
|
||||
void (*setClipboardText)(const char* text);
|
||||
bool (*hasClipboardText)();
|
||||
char* (*getClipboardText)();
|
||||
u64 (*getPerformanceCounter)();
|
||||
u64 (*getPerformanceFrequency)();
|
||||
|
||||
NetVersion (*netVersionRequest)(Net* net);
|
||||
void (*netDirRequest)(Net* net, const char* path, ListCallback callback, void* data);
|
||||
void* (*netGetRequest)(Net* net, const char* path, s32* size);
|
||||
Net* (*createNet)();
|
||||
void (*closeNet)(Net* net);
|
||||
|
||||
} System;
|
||||
|
||||
TIC80_API Studio* studioInit(s32 argc, char **argv, s32 samplerate, const char* appFolder, System* system);
|
||||
TIC80_API void studioTick(void* pixels);
|
||||
TIC80_API void studioClose();
|
||||
|
||||
char getKeyboardText();
|
||||
bool isKeyWasDown(tic_key key);
|
||||
|
@ -231,3 +248,9 @@ char* getClipboardText();
|
|||
|
||||
u64 getPerformanceCounter();
|
||||
u64 getPerformanceFrequency();
|
||||
|
||||
NetVersion _netVersionRequest(Net* net);
|
||||
void _netDirRequest(Net* net, const char* path, ListCallback callback, void* data);
|
||||
void* _netGetRequest(Net* net, const char* path, s32* size);
|
||||
Net* _createNet();
|
||||
void _closeNet(Net* net);
|
||||
|
|
|
@ -478,7 +478,7 @@ static void* requestCover(Surf* surf, const char* hash, s32* size)
|
|||
|
||||
char path[FILENAME_MAX] = {0};
|
||||
sprintf(path, "/cart/%s/cover.gif", hash);
|
||||
void* data = netGetRequest(surf->net, path, size);
|
||||
void* data = _netGetRequest(surf->net, path, size);
|
||||
|
||||
if(data)
|
||||
{
|
||||
|
@ -865,7 +865,7 @@ void initSurf(Surf* surf, tic_mem* tic, struct Console* console)
|
|||
.items = NULL,
|
||||
.count = 0,
|
||||
},
|
||||
.net = createNet(),
|
||||
.net = _createNet(),
|
||||
};
|
||||
|
||||
fsMakeDir(surf->fs, TIC_CACHE);
|
||||
|
|
|
@ -51,4 +51,4 @@ 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);
|
||||
u32 tic_tool_find_closest_color(const tic_rgb* palette, const tic_rgb* color);
|
||||
u32* tic_palette_blit(const tic_palette* src);
|
||||
TIC80_API u32* tic_palette_blit(const tic_palette* src);
|
Loading…
Reference in New Issue