Skip to content

Commit

Permalink
(MSVC 2010) Use DEF file
Browse files Browse the repository at this point in the history
  • Loading branch information
TwinAphex51224 committed May 18, 2012
1 parent 279c133 commit 253d21e
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 52 deletions.
60 changes: 25 additions & 35 deletions libretro/libretro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@
#define FALSE 0
#endif

#define LIBRETRO_CORE 1

#if defined(_MSC_VER) && defined(LIBRETRO_CORE) && !defined(_XBOX)
#define EXPORT __declspec(dllexport)
#else
#define EXPORT
#endif

#include "libretro.hpp"

#include "system.h"
Expand All @@ -38,15 +30,15 @@ uint8_t libretro_save_buf[0x20000 + 0x2000]; /* Workaround for broken-by-design

static unsigned libretro_save_size = sizeof(libretro_save_buf);

EXPORT void *retro_get_memory_data(unsigned id)
void *retro_get_memory_data(unsigned id)
{
if (id != RETRO_MEMORY_SAVE_RAM)
return 0;

return libretro_save_buf;
}

EXPORT size_t retro_get_memory_size(unsigned id)
size_t retro_get_memory_size(unsigned id)
{
if (id != RETRO_MEMORY_SAVE_RAM)
return 0;
Expand Down Expand Up @@ -100,44 +92,43 @@ static void adjust_save_ram()
}


EXPORT unsigned retro_api_version(void)
unsigned retro_api_version(void)
{
return RETRO_API_VERSION;
}

EXPORT void retro_set_video_refresh(retro_video_refresh_t cb)
void retro_set_video_refresh(retro_video_refresh_t cb)
{
video_cb = cb;
}

EXPORT void retro_set_audio_sample(retro_audio_sample_t cb)
void retro_set_audio_sample(retro_audio_sample_t cb)
{ }

EXPORT void retro_set_audio_sample_batch(retro_audio_sample_batch_t cb)
void retro_set_audio_sample_batch(retro_audio_sample_batch_t cb)
{
audio_batch_cb = cb;
}

EXPORT void retro_set_input_poll(retro_input_poll_t cb)
void retro_set_input_poll(retro_input_poll_t cb)
{
poll_cb = cb;
}

EXPORT void retro_set_input_state(retro_input_state_t cb)
void retro_set_input_state(retro_input_state_t cb)
{
input_cb = cb;
}

EXPORT void retro_set_controller_port_device(unsigned port, unsigned device)
void retro_set_controller_port_device(unsigned port, unsigned device)
{ }


EXPORT void retro_set_environment(retro_environment_t cb)
void retro_set_environment(retro_environment_t cb)
{
environ_cb = cb;
}

EXPORT void retro_get_system_info(struct retro_system_info *info)
void retro_get_system_info(struct retro_system_info *info)
{
info->need_fullpath = false;
info->valid_extensions = "gba|GBA|zip|ZIP";
Expand All @@ -146,7 +137,7 @@ EXPORT void retro_get_system_info(struct retro_system_info *info)
info->block_extract = false;
}

EXPORT void retro_get_system_av_info(struct retro_system_av_info *info)
void retro_get_system_av_info(struct retro_system_av_info *info)
{
info->geometry.base_width = 240;
info->geometry.base_height = 160;
Expand All @@ -156,7 +147,7 @@ EXPORT void retro_get_system_av_info(struct retro_system_av_info *info)
info->timing.sample_rate = 32000.0;
}

EXPORT void retro_init(void)
void retro_init(void)
{
memset(libretro_save_buf, 0xff, sizeof(libretro_save_buf));
adjust_save_ram();
Expand Down Expand Up @@ -354,15 +345,14 @@ static void gba_init(void)
free(state_buf);
}

EXPORT void retro_deinit(void) {}
void retro_deinit(void) {}

EXPORT void retro_reset(void)
void retro_reset(void)
{
CPUReset();
}


EXPORT void retro_run(void)
void retro_run(void)
{

CPULoop();
Expand Down Expand Up @@ -390,28 +380,28 @@ EXPORT void retro_run(void)
joy = J;
}

EXPORT size_t retro_serialize_size(void)
size_t retro_serialize_size(void)
{
return serialize_size;
}

EXPORT bool retro_serialize(void *data, size_t size)
bool retro_serialize(void *data, size_t size)
{
return CPUWriteState((uint8_t*)data, size);
}

EXPORT bool retro_unserialize(const void *data, size_t size)
bool retro_unserialize(const void *data, size_t size)
{
return CPUReadState((uint8_t*)data, size);
}

EXPORT void retro_cheat_reset(void)
void retro_cheat_reset(void)
{}

EXPORT void retro_cheat_set(unsigned, bool, const char*)
void retro_cheat_set(unsigned, bool, const char*)
{}

EXPORT bool retro_load_game(const struct retro_game_info *game)
bool retro_load_game(const struct retro_game_info *game)
{
bool ret = CPULoadRom(game->path);

Expand All @@ -420,16 +410,16 @@ EXPORT bool retro_load_game(const struct retro_game_info *game)
return ret;
}

EXPORT bool retro_load_game_special(
bool retro_load_game_special(
unsigned game_type,
const struct retro_game_info *info, size_t num_info
)
{ return false; }

EXPORT void retro_unload_game(void)
void retro_unload_game(void)
{}

EXPORT unsigned retro_get_region(void)
unsigned retro_get_region(void)
{
return RETRO_REGION_NTSC;
}
Expand Down
27 changes: 27 additions & 0 deletions msvc-2010/libretro.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
LIBRARY "libretro-prboom msvc2010"
EXPORTS
retro_set_environment
retro_set_video_refresh
retro_set_audio_sample
retro_set_audio_sample_batch
retro_set_input_poll
retro_set_input_state
retro_init
retro_deinit
retro_api_version
retro_get_system_info
retro_get_system_av_info
retro_set_controller_port_device
retro_reset
retro_run
retro_serialize_size
retro_serialize
retro_unserialize
retro_cheat_reset
retro_cheat_set
retro_load_game
retro_load_game_special
retro_unload_game
retro_get_region
retro_get_memory_data
retro_get_memory_size
11 changes: 6 additions & 5 deletions msvc-2010/msvc-2010.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ModuleDefinitionFile>libretro.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand All @@ -76,14 +77,14 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<ModuleDefinitionFile>libretro.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\libretro\libretro.cpp" />
<ClCompile Include="..\src\gba\GBA.cpp" />
<ClCompile Include="..\src\gba\Memory.cpp" />
<ClCompile Include="..\src\gba\Sound.cpp" />
<ClCompile Include="..\src\Util.cpp" />
<ClCompile Include="..\src\gba.cpp" />
<ClCompile Include="..\src\memory.cpp" />
<ClCompile Include="..\src\sound.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\libretro\libretro.hpp" />
Expand All @@ -101,4 +102,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
18 changes: 6 additions & 12 deletions msvc-2010/msvc-2010.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
<Filter Include="Source Files\libretro">
<UniqueIdentifier>{3ed03eb4-3d22-42ca-b2ab-1058e771db27}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\gba">
<UniqueIdentifier>{b72b4e4d-41cc-47ac-ae75-05fc547fd36d}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\libretro">
<UniqueIdentifier>{01290b17-a062-4772-8a90-1fb347398419}</UniqueIdentifier>
</Filter>
Expand All @@ -33,17 +30,14 @@
<ClCompile Include="..\libretro\libretro.cpp">
<Filter>Source Files\libretro</Filter>
</ClCompile>
<ClCompile Include="..\src\gba\GBA.cpp">
<Filter>Source Files\gba</Filter>
</ClCompile>
<ClCompile Include="..\src\gba\Sound.cpp">
<Filter>Source Files\gba</Filter>
<ClCompile Include="..\src\sound.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\Util.cpp">
<ClCompile Include="..\src\gba.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\gba\Memory.cpp">
<Filter>Source Files\gba</Filter>
<ClCompile Include="..\src\memory.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -81,4 +75,4 @@
<Filter>Header Files\common</Filter>
</ClInclude>
</ItemGroup>
</Project>
</Project>

0 comments on commit 253d21e

Please sign in to comment.