Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion platform/linux/CMakeList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,7 @@ add_executable( Solar2DBuilder
${CORONA_ROOT}/tools/CoronaBuilder/main.cpp
${CORONA_ROOT}/tools/CoronaBuilder/Rtt_CoronaBuilder.cpp
${CORONA_ROOT}/tools/CoronaBuilder/Rtt_AppPackagerFactory.cpp
${CORONA_ROOT}/platform/shared/Rtt_AndroidSupportTools.c
${CORONA_ROOT}/tools/CoronaBuilder/Rtt_AppPackagerAndroidFactory.cpp
${CORONA_ROOT}/tools/CoronaBuilder/Rtt_AppPackagerHTML5Factory.cpp
${CORONA_ROOT}/tools/CoronaBuilder/Rtt_AppPackagerLinuxFactory.cpp
Expand Down Expand Up @@ -1028,7 +1029,7 @@ target_compile_definitions( Solar2DSimulator PUBLIC

target_compile_definitions( Solar2DBuilder PUBLIC
Rtt_BUILD_REVISION=${BUILD_NUMBER} Rtt_BUILD_YEAR=${YEAR}
LUA_USE_POPEN Rtt_LUA_COMPILER Rtt_SIMULATOR CORONABUILDER_LINUX LUA_DL_DLOPEN
LUA_USE_POPEN Rtt_LUA_COMPILER Rtt_SIMULATOR CORONABUILDER_LINUX CORONABUILDER_HTML5 CORONABUILDER_ANDROID LUA_DL_DLOPEN
Rtt_LINUX_ENV ALMIXER_COMPILE_WITHOUT_SDL SOUND_SUPPORTS_WAV SOUND_SUPPORTS_MPG123 SOUND_SUPPORTS_OGG
OPT_GENERIC HAVE_STRERROR NO_REAL ENABLE_ALMIXER_THREADS LINUX_LIB)

Expand Down
1 change: 1 addition & 0 deletions platform/linux/CMakeResources.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ file(COPY "${CORONA_ROOT}/platform/resources/json.lua" DESTINATION ${RESOURCES}
file(COPY "${CORONA_ROOT}/platform/resources/dkjson.lua" DESTINATION ${RESOURCES} FILE_PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
file(COPY "${CORONA_ROOT}/platform/resources/CoronaPListSupport.lua" DESTINATION ${RESOURCES} FILE_PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
file(COPY "${CORONA_ROOT}/platform/resources/AppSettings.lua" DESTINATION ${RESOURCES} FILE_PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
file(COPY "${CORONA_ROOT}/platform/resources/AndroidValidation.lua" DESTINATION ${RESOURCES} FILE_PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

file(COPY "${CORONA_ROOT}/platform/android/create_build_properties.lua" DESTINATION ${RESOURCES} FILE_PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
file(COPY "${CORONA_ROOT}/platform/android/resources/build.xml" DESTINATION ${RESOURCES} FILE_PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
Expand Down
11 changes: 11 additions & 0 deletions platform/linux/src/Rtt_LinuxBitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,17 @@ namespace Rtt
return false;

Format fmt = bitmap->GetFormat();

// A captured frame is tagged kBGRA but lands in memory as A,R,G,B (packed
// readback, little-endian). The writers below take byte order, so describe it
// as it is, or red and green come back swapped and blue from the alpha byte.
#ifndef Rtt_BIG_ENDIAN
if (fmt == PlatformBitmap::kBGRA)
{
fmt = PlatformBitmap::kARGB;
}
#endif

bool rc = false;

std::string path = filePath;
Expand Down
37 changes: 36 additions & 1 deletion platform/shared/Rtt_BitmapUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,27 @@ namespace bitmapUtil
break;
}
case Rtt::PlatformBitmap::Format::kABGR:
case Rtt::PlatformBitmap::Format::kARGB:
Rtt_ASSERT(0); //todo
break;

case Rtt::PlatformBitmap::Format::kARGB:
{
// convert to RGB
rgb.reset((uint8_t*)malloc(width * height * 3));
uint8_t* src = data;
uint8_t* dst = rgb.get();
for (int i = 0; i < width * height; i++)
{
dst[0] = src[1];
dst[1] = src[2];
dst[2] = src[3];
dst += 3;
src += 4;
}
data = rgb.get();
break;
}

case Rtt::PlatformBitmap::Format::kBGRA:
{
// convert to RGB
Expand Down Expand Up @@ -400,6 +417,24 @@ namespace bitmapUtil
data = rgba;
free_data = true;
}
else if (format == Rtt::PlatformBitmap::Format::kARGB)
{
// ARGB ==> RGBA
U8* rgba = (U8*)malloc(width * height * 4);
U8* src = data;
U8* dst = rgba;
for (int i = 0; i < width * height; i++)
{
dst[0] = src[1];
dst[1] = src[2];
dst[2] = src[3];
dst[3] = src[0];
dst += 4;
src += 4;
}
data = rgba;
free_data = true;
}

for (int y = 0; y < height; y++)
{
Expand Down
2 changes: 2 additions & 0 deletions tools/CoronaBuilder/Rtt_AppPackagerAndroidFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ AppPackagerFactory::CreatePackagerParamsAndroid(
scriptPathStr.Set(GetResourceDirectory());
#if defined(Rtt_MAC_ENV)
scriptPathStr.Append("/AndroidValidation.lu");
#elif defined(Rtt_LINUX_ENV)
scriptPathStr.Append("/AndroidValidation.lua");
#elif defined(Rtt_WIN_ENV)
scriptPathStr.Append("/AndroidValidation.lua");
#endif
Expand Down
14 changes: 14 additions & 0 deletions tools/CoronaBuilder/Rtt_AppPackagerFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
#if defined(CORONABUILDER_LINUX)
#include "Rtt_LinuxAppPackager.h"
#endif
#if defined(Rtt_LINUX_ENV)
#include "Rtt_LinuxUtils.h"
#include <string>
#endif

#ifdef Rtt_WIN_ENV
#include "Rtt_JavaHost.h"
Expand Down Expand Up @@ -394,6 +398,16 @@ AppPackagerFactory::GetResourceDirectory() const
return GetResourceDirectoryOSX();
#elif defined(Rtt_WIN_ENV)
return GetResourceDirectoryWin();
#elif defined(Rtt_LINUX_ENV)
// Resources live beside the executable in the Linux layout.
static std::string resourceDir;
if (resourceDir.empty())
{
resourceDir = std::string(GetStartupPath(NULL)) + "/Resources";
}
return resourceDir.c_str();
#else
return NULL;
#endif
}

Expand Down
19 changes: 15 additions & 4 deletions tools/CoronaBuilder/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "Rtt_LinuxSimulatorView.h"
#include "Rtt_LinuxUtils.h"
#include <string>
#include <cstdlib>
#include <unistd.h>

using namespace std;

Expand All @@ -28,10 +30,19 @@ int main(int argc, const char *argv[])
string skinDir;

// setup directory paths
documentsDir.append("/Documents");
temporaryDir.append("/TemporaryFiles");
cachesDir.append("/CachedFiles");
systemCachesDir.append("/.system");
// The strings start empty, so appending alone puts the builder's sandbox at
// the root of the filesystem, writable only by root. Keep it in TMPDIR, one
// per uid so a shared /tmp does not lock the second user out.
const char *tmpDir = getenv("TMPDIR");
if (tmpDir == NULL || tmpDir[0] == '\0')
{
tmpDir = "/tmp";
}
string sandboxDir = string(tmpDir) + "/Solar2DBuilder-" + to_string(getuid());
documentsDir = sandboxDir + "/Documents";
temporaryDir = sandboxDir + "/TemporaryFiles";
cachesDir = sandboxDir + "/CachedFiles";
systemCachesDir = sandboxDir + "/.system";

Rtt::LinuxConsolePlatform *platform = new Rtt::LinuxConsolePlatform(pathToApp.c_str(), documentsDir.c_str(), temporaryDir.c_str(), cachesDir.c_str(), systemCachesDir.c_str(), skinDir.c_str(), GetStartupPath(NULL));
Rtt::LinuxPlatformServices services(platform);
Expand Down