Merge with develop

This commit is contained in:
kervala 2016-01-03 18:16:07 +01:00
parent 50b846d56c
commit a046a06db3
17 changed files with 176 additions and 84 deletions

View file

@ -144,6 +144,28 @@ IF(WITH_SSE2)
ENDIF(WITH_SSE3)
ENDIF(WITH_SSE2)
IF(APPLE_CERTIFICATE)
# Find codesign_allocate
# Xcode 7.0 and later versions
SET(CODESIGN_ALLOCATE ${OSX_DEVELOPER_ROOT}/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate)
IF(NOT EXISTS "${CODESIGN_ALLOCATE}")
# Xcode 6.4 and previous versions
SET(CODESIGN_ALLOCATE ${CMAKE_OSX_SYSROOT}/usr/bin/codesign_allocate)
ENDIF()
IF(NOT EXISTS "${CODESIGN_ALLOCATE}")
# System path
SET(CODESIGN_ALLOCATE /usr/bin/codesign_allocate)
ENDIF()
IF(NOT EXISTS "${CODESIGN_ALLOCATE}")
MESSAGE(WARNING "Unable to find codesign_allocate in standard directories")
SET(CODESIGN_ALLOCATE)
ENDIF()
ENDIF()
MACRO(ADD_QT_LIBRARY _NAME)
IF(WIN32)
SET(_PREFIX "Qt5")

View file

@ -443,14 +443,14 @@ bool CBitmap::isGrayscale() const
uint32 *data = (uint32*)_Data[0].getPtr();
uint32 *endData = (uint32*)((uint8*)data + size);
NLMISC::CRGBA color;
NLMISC::CRGBA *color = NULL;
// check if all alphas have the same value
while(data < endData)
{
color.set8888(*data);
color = (NLMISC::CRGBA*)data;
if (!color.isGray()) return false;
if (!color->isGray()) return false;
++data;
}

View file

@ -784,12 +784,6 @@ bool launchProgram(const std::string &programName, const std::string &arguments,
}
argv[i+1] = NULL;
// save LD_LIBRARY_PATH
const char *previousEnv = getenv("LD_LIBRARY_PATH");
// clear LD_LIBRARY_PATH to avoid problems with Steam Runtime
setenv("LD_LIBRARY_PATH", "", 1);
int status = vfork ();
/////////////////////////////////////////////////////////
/// WARNING : NO MORE INSTRUCTION AFTER VFORK !
@ -800,9 +794,6 @@ bool launchProgram(const std::string &programName, const std::string &arguments,
char *err = strerror (errno);
if (log)
nlwarning("LAUNCH: Failed launched '%s' with arg '%s' err %d: '%s'", programName.c_str(), arguments.c_str(), errno, err);
// restore previous LD_LIBRARY_PATH
setenv("LD_LIBRARY_PATH", previousEnv, 1);
}
else if (status == 0)
{
@ -819,9 +810,6 @@ bool launchProgram(const std::string &programName, const std::string &arguments,
{
//nldebug("LAUNCH: Successful launch '%s' with arg '%s'", programName.c_str(), arguments.c_str());
// restore previous LD_LIBRARY_PATH
setenv("LD_LIBRARY_PATH", previousEnv, 1);
return true;
}
#endif
@ -890,12 +878,6 @@ sint launchProgramAndWaitForResult(const std::string &programName, const std::st
CloseHandle(pi.hThread);
}
#else
// save LD_LIBRARY_PATH
const char *previousEnv = getenv("LD_LIBRARY_PATH");
// clear LD_LIBRARY_PATH to avoid problems with Steam Runtime
setenv("LD_LIBRARY_PATH", "", 1);
// program name is the only required string
std::string command = programName;
@ -905,9 +887,6 @@ sint launchProgramAndWaitForResult(const std::string &programName, const std::st
// execute the command
res = system(command.c_str());
// restore previous LD_LIBRARY_PATH
setenv("LD_LIBRARY_PATH", previousEnv, 1);
if (res && log)
nlwarning ("LAUNCH: Failed launched '%s' with arg '%s' return code %d", programName.c_str(), arguments.c_str(), res);
#endif
@ -1253,8 +1232,18 @@ static bool openDocWithExtension (const char *document, const char *ext)
return false;
}
return launchProgram(command, document);
// save LD_LIBRARY_PATH
const char *previousEnv = getenv("LD_LIBRARY_PATH");
// clear LD_LIBRARY_PATH to avoid problems with Steam Runtime
setenv("LD_LIBRARY_PATH", "", 1);
bool res = launchProgram(command, document);
// restore previous LD_LIBRARY_PATH
setenv("LD_LIBRARY_PATH", previousEnv, 1);
return res;
#endif // NL_OS_WINDOWS
return false;

View file

@ -83,7 +83,8 @@ void CLog::setProcessName (const std::string &processName)
}
}
*_ProcessName = processName;
// keep only filename without path
*_ProcessName = CFile::getFilename(processName);
}
void CLog::setPosition (sint line, const char *fileName, const char *funcName)

View file

@ -46,7 +46,7 @@ void CColorModifier::convertBitmap(NLMISC::CBitmap &destBitmap, const NLMISC::CB
const NLMISC::CRGBA *src = (NLMISC::CRGBA *) &srcBitmap.getPixels()[0];
const NLMISC::CRGBA *mask = (NLMISC::CRGBA *) &maskBitmap.getPixels()[0];
const uint8 *mask = &maskBitmap.getPixels()[0];
NLMISC::CRGBA *dest = (NLMISC::CRGBA *) &destBitmap.getPixels()[0];
@ -69,7 +69,7 @@ void CColorModifier::convertBitmap(NLMISC::CBitmap &destBitmap, const NLMISC::CB
result.B = CalcBrightnessContrast(result.B, Luminosity, Contrast, grey);
// blend to the destination by using the mask alpha
result.blendFromui(*dest, result, mask->R);
result.blendFromui(*dest, result, *mask);
/// keep alpha from the source
dest->R = result.R;
@ -111,7 +111,7 @@ void CColorModifier::evalBitmapStats(const NLMISC::CBitmap &srcBitmap,
float gTotal = 0;
const NLMISC::CRGBA *src = (NLMISC::CRGBA *) &srcBitmap.getPixels()[0];
const NLMISC::CRGBA *mask = (NLMISC::CRGBA *) &maskBitmap.getPixels()[0];
const uint8 *mask = &maskBitmap.getPixels()[0];
for (uint y = 0; y < srcBitmap.getHeight(); ++y)
{
@ -119,7 +119,7 @@ void CColorModifier::evalBitmapStats(const NLMISC::CBitmap &srcBitmap,
{
float h, l, s;
float intensity = mask->R * (1.f / 255.f);
float intensity = *mask * (1.f / 255.f);
bool achromatic = src->convertToHLS(h, l, s);
float grey = 0.299f * src->R + 0.587f * src->G + 0.114f * src->B;

View file

@ -43,18 +43,15 @@ void CHLSBankTextureInfo::serial(NLMISC::IStream &f)
// ***************************************************************************
void CHLSBankTextureInfo::CMaskBitmap::build(const NLMISC::CBitmap &src)
{
nlassert(src.getPixelFormat()==CBitmap::RGBA);
nlassert(src.getPixelFormat()==CBitmap::Luminance);
Width= src.getWidth();
Height= src.getHeight();
Pixels.resize(Width*Height);
if(!Pixels.empty())
{
CRGBA *pSrc= (CRGBA*)(&src.getPixels()[0]);
uint8 *pDst= &Pixels[0];
for(uint i=0; i<Pixels.size(); i++)
{
pDst[i]= pSrc[i].R;
}
uint8 *pSrc = (uint8*)src.getPixels().getPtr();
uint8 *pDst = &Pixels[0];
memcpy(pDst, pSrc, Pixels.size());
}
}

View file

@ -795,8 +795,38 @@ static void BuildColoredVersionForOneBitmap(const CBuildInfo &bi, const std::str
// masks can be converted to grayscale files
if (bi.OptimizeTextures > 0 && maskDepth > 8)
{
if (!li.Mask.isGrayscale())
{
nlwarning("Mask %s is using colors, results may by incorrect! Use OptimizeTextures = 2 to fix it.", maskFileName.c_str());
}
if (bi.OptimizeTextures > 1)
{
// get a pointer on original data
uint32 size = li.Mask.getPixels().size();
uint32 *data = (uint32*)li.Mask.getPixels().getPtr();
uint32 *endData = (uint32*)((uint8*)data + size);
NLMISC::CRGBA *color = NULL;
// process all pixels
while(data < endData)
{
color = (NLMISC::CRGBA*)data;
// copy red value to green and blue,
// because only red is used for mask
color->B = color->G = color->R;
// make opaque
color->A = 255;
++data;
}
// convert image to real grayscale
li.Mask.convertToType(NLMISC::CBitmap::Luminance);
NLMISC::COFile os;
if (os.open(maskFileName))
@ -826,9 +856,9 @@ static void BuildColoredVersionForOneBitmap(const CBuildInfo &bi, const std::str
}
}
if (li.Mask.PixelFormat != NLMISC::CBitmap::RGBA)
if (li.Mask.PixelFormat != NLMISC::CBitmap::Luminance)
{
li.Mask.convertToType(NLMISC::CBitmap::RGBA);
li.Mask.convertToType(NLMISC::CBitmap::Luminance);
}
/// make sure the mask has the same size
@ -969,5 +999,4 @@ static void BuildColoredVersionForOneBitmap(const CBuildInfo &bi, const std::str
{
nlerror("Couldn't write %s", fullHlsInfoPath.c_str());
}
}

View file

@ -1,7 +1,9 @@
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SRC_DIR})
FILE(GLOB CRASHREPORT_SRC *.cpp)
FILE(GLOB CRASHREPORT_SRC *.cpp *.rc)
FILE(GLOB CRASHREPORT_HDR *.h)
SET(CRASHREPORT_QRC resources.qrc)
SET(CRASHREPORT_MOC_HDR
crash_report_socket.h
crash_report_widget.h
@ -22,25 +24,35 @@ IF(WITH_QT)
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})
QT4_ADD_RESOURCES(CRASHREPORT_QRC_SRCS ${CRASHREPORT_QRC})
QT4_WRAP_CPP(CRASHREPORT_MOC_SRC ${CRASHREPORT_MOC_HDR})
QT4_WRAP_UI(CRASHREPORT_UI_HDR ${CRASHREPORT_UI})
SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY})
ELSE()
QT5_ADD_RESOURCES(CRASHREPORT_QRC_SRCS ${CRASHREPORT_QRC})
QT5_WRAP_CPP(CRASHREPORT_MOC_SRC ${CRASHREPORT_MOC_HDR})
QT5_WRAP_UI(CRASHREPORT_UI_HDR ${CRASHREPORT_UI})
ENDIF()
SOURCE_GROUP(QtResources FILES ${CRASHREPORT_UI})
SOURCE_GROUP(QtResources FILES ${CRASHREPORT_UI} ${CRASHREPORT_QRC_SRCS})
SOURCE_GROUP(QtGeneratedUiHdr FILES ${CRASHREPORT_UI_HDR})
SOURCE_GROUP(QtGeneratedMocQrcSrc FILES ${CRASHREPORT_MOC_SRC})
SOURCE_GROUP(QtGeneratedMocSrc FILES ${CRASHREPORT_MOC_SRC})
SOURCE_GROUP("source files" FILES ${CRASHREPORT_SRC})
SOURCE_GROUP("header files" FILES ${CRASHREPORT_HDR})
ADD_EXECUTABLE(crash_report WIN32 ${CRASHREPORT_SRC} ${CRASHREPORT_HDR} ${CRASHREPORT_MOC_SRC} ${CRASHREPORT_UI_HDR})
ADD_EXECUTABLE(crash_report WIN32 ${CRASHREPORT_SRC} ${CRASHREPORT_HDR} ${CRASHREPORT_MOC_SRC} ${CRASHREPORT_UI_HDR} ${CRASHREPORT_QRC_SRCS})
TARGET_LINK_LIBRARIES(crash_report ${QT_LIBRARIES})
NL_DEFAULT_PROPS(crash_report "NeL, Tools, Misc: Crash Report")
NL_ADD_RUNTIME_FLAGS(crash_report)
INSTALL(TARGETS crash_report RUNTIME DESTINATION ${NL_BIN_PREFIX})
IF(WITH_RYZOM_CLIENT AND APPLE)
IF(CODESIGN_ALLOCATE AND APPLE_CERTIFICATE)
ADD_CUSTOM_COMMAND(TARGET crash_report POST_BUILD COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign -fs "${APPLE_CERTIFICATE}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/crash_report" COMMENT "Signing crash_report executable...")
ENDIF()
ADD_CUSTOM_COMMAND(TARGET crash_report POST_BUILD COMMAND cp -p ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/crash_report ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${MACOSX_BUNDLE_BUNDLE_NAME}.app/Contents/MacOS/CrashReport)
ENDIF()

View file

@ -105,7 +105,9 @@ int main(int argc, char **argv)
}
#endif
QApplication app( argc, argv );
QApplication app(argc, argv);
QApplication::setWindowIcon(QIcon(":/icons/nevraxpill.ico"));
std::vector< std::pair< std::string, std::string > > params;

View file

@ -0,0 +1,35 @@
#include <windows.h>
#include "config.h"
IDI_MAIN_ICON ICON DISCARDABLE "nevraxpill.ico"
VS_VERSION_INFO VERSIONINFO
FILEVERSION NL_VERSION_RC
PRODUCTVERSION NL_VERSION_RC
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "Crash Report"
VALUE "FileVersion", NL_VERSION
VALUE "LegalCopyright", COPYRIGHT
VALUE "OriginalFilename", "crash_report.exe"
VALUE "ProductName", "Ryzom Core"
VALUE "ProductVersion", NL_VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1252
END
END

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/icons">
<file>nevraxpill.ico</file>
</qresource>
</RCC>

View file

@ -79,28 +79,9 @@ IF(WITH_RYZOM_CLIENT)
ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -RpX ${RYZOM_DATA_DIR} ${RYZOM_RESOURCES_DIR})
ENDIF()
IF(APPLE_CERTIFICATE)
# Find codesign_allocate
# Xcode 7.0 and later versions
SET(CODESIGN_ALLOCATE ${OSX_DEVELOPER_ROOT}/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate)
IF(NOT EXISTS "${CODESIGN_ALLOCATE}")
# Xcode 6.4 and previous versions
SET(CODESIGN_ALLOCATE ${CMAKE_OSX_SYSROOT}/usr/bin/codesign_allocate)
ENDIF()
IF(NOT EXISTS "${CODESIGN_ALLOCATE}")
# System path
SET(CODESIGN_ALLOCATE /usr/bin/codesign_allocate)
ENDIF()
IF(NOT EXISTS "${CODESIGN_ALLOCATE}")
MESSAGE(WARNING "Unable to find codesign_allocate in standard directories")
ELSE()
IF(CODESIGN_ALLOCATE AND APPLE_CERTIFICATE)
ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign -fs "${APPLE_CERTIFICATE}" "${RYZOM_OUTPUT_DIR}" COMMENT "Signing bundle...")
ENDIF()
ENDIF()
IF(WITH_RYZOM_STEAM)
ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -p ${MAC_RESOURCES_DIR}/installscript_osx.vdf ${RYZOM_OUTPUT_DIR})

View file

@ -106,15 +106,6 @@ void quitCrashReport ()
contReset(CrashCounterSock);
}
#ifndef NL_OS_WINDOWS
static void sigHandler(int Sig)
{
// redirect the signal for the next time
signal(Sig, sigHandler);
nlwarning("Ignoring signal SIGPIPE");
}
#endif
//---------------------------------------------------
// MAIN :
// Entry for the Application.
@ -548,9 +539,6 @@ int main(int argc, char **argv)
// set process name for logs
CLog::setProcessName(filename);
// ignore signal SIGPIPE generated by libwww
signal(SIGPIPE, sigHandler);
// Delete the .sh file because it s not useful anymore
if (NLMISC::CFile::fileExists("updt_nl.sh"))
NLMISC::CFile::deleteFile("updt_nl.sh");

View file

@ -990,11 +990,26 @@ void prelogInit()
// Check the driver is not is 16 bits
checkDriverDepth ();
// For login phase, MUST be in windowed
UDriver::CMode mode;
bool forceWindowed1024x768 = true;
if (Driver->getCurrentScreenMode(mode))
{
// if screen mode lower than 1024x768, use same mode in fullscreen
if (mode.Width <= 1024 && mode.Height <= 768)
{
mode.Windowed = false;
forceWindowed1024x768 = false;
}
}
if (forceWindowed1024x768)
{
mode.Width = 1024;
mode.Height = 768;
mode.Windowed = true;
}
// Disable Hardware Vertex Program.
if(ClientCfg.DisableVtxProgram)

View file

@ -69,3 +69,11 @@ IF(WITH_PCH)
ENDIF()
INSTALL(TARGETS ryzom_configuration_qt RUNTIME DESTINATION ${RYZOM_GAMES_PREFIX} COMPONENT client)
IF(WITH_RYZOM_CLIENT AND APPLE)
IF(CODESIGN_ALLOCATE AND APPLE_CERTIFICATE)
ADD_CUSTOM_COMMAND(TARGET ryzom_configuration_qt POST_BUILD COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign -fs "${APPLE_CERTIFICATE}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ryzom_configuration_qt" COMMENT "Signing ryzom_configuration_qt executable...")
ENDIF()
ADD_CUSTOM_COMMAND(TARGET ryzom_configuration_qt POST_BUILD COMMAND cp -p ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ryzom_configuration_qt ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${MACOSX_BUNDLE_BUNDLE_NAME}.app/Contents/MacOS/RyzomConfiguration)
ENDIF()

View file

@ -43,3 +43,11 @@ IF(WITH_PCH)
ENDIF(WITH_PCH)
INSTALL(TARGETS ryzom_client_patcher RUNTIME DESTINATION ${RYZOM_GAMES_PREFIX} COMPONENT client BUNDLE DESTINATION /Applications)
IF(WITH_RYZOM_CLIENT AND APPLE)
IF(CODESIGN_ALLOCATE AND APPLE_CERTIFICATE)
ADD_CUSTOM_COMMAND(TARGET ryzom_client_patcher POST_BUILD COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign -fs "${APPLE_CERTIFICATE}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ryzom_client_patcher" COMMENT "Signing ryzom_client_patcher executable...")
ENDIF()
ADD_CUSTOM_COMMAND(TARGET ryzom_client_patcher POST_BUILD COMMAND cp -p ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ryzom_client_patcher ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${MACOSX_BUNDLE_BUNDLE_NAME}.app/Contents/MacOS/RyzomClientPatcher)
ENDIF()