From 613ceada9a985b56ce2f16b4d4cddc4596d081d6 Mon Sep 17 00:00:00 2001 From: Joseph Davies Date: Fri, 24 Jun 2011 18:04:47 -0700 Subject: [PATCH] Add automatic creation of external plClient resources. --- Sources/Plasma/Apps/plClient/CMakeLists.txt | 6 +- .../Apps/plClient/external/CMakeLists.txt | 30 + .../Apps/plClient/external/Cursor_Base.svg | 383 ++++ .../Apps/plClient/external/Linking_Book.svg | 508 ++++++ .../external/Loading_Text_rasterfont.svg | 207 +++ .../Apps/plClient/external/Voice_Chat.svg | 1595 +++++++++++++++++ .../plClient/external/create_resource_dat.py | 62 + .../Plasma/Apps/plClient/external/makeres.py | 52 + .../Apps/plClient/external/render_svg.py | 205 +++ 9 files changed, 3047 insertions(+), 1 deletion(-) create mode 100644 Sources/Plasma/Apps/plClient/external/CMakeLists.txt create mode 100644 Sources/Plasma/Apps/plClient/external/Cursor_Base.svg create mode 100644 Sources/Plasma/Apps/plClient/external/Linking_Book.svg create mode 100644 Sources/Plasma/Apps/plClient/external/Loading_Text_rasterfont.svg create mode 100644 Sources/Plasma/Apps/plClient/external/Voice_Chat.svg create mode 100644 Sources/Plasma/Apps/plClient/external/create_resource_dat.py create mode 100644 Sources/Plasma/Apps/plClient/external/makeres.py create mode 100644 Sources/Plasma/Apps/plClient/external/render_svg.py diff --git a/Sources/Plasma/Apps/plClient/CMakeLists.txt b/Sources/Plasma/Apps/plClient/CMakeLists.txt index 521994e3..fd4ccd22 100644 --- a/Sources/Plasma/Apps/plClient/CMakeLists.txt +++ b/Sources/Plasma/Apps/plClient/CMakeLists.txt @@ -15,6 +15,8 @@ include_directories(${OPENSSL_INCLUDE_DIR}) include_directories(${PYTHON_INCLUDE_DIR}) include_directories(${CURL_INCLUDE_DIR}) +add_subdirectory(external) + set(plClient_HEADERS plClient.h plClientCreatable.h @@ -40,7 +42,6 @@ set(plClient_TEXT set(plClient_RESOURCES res/plClient.rc res/resource.h - res/banner.bmp res/cnsl1.bin res/Dirt.ICO @@ -49,6 +50,9 @@ set(plClient_RESOURCES add_executable(plClient WIN32 ${plClient_SOURCES} ${plClient_HEADERS} ${plClient_TEXT} ${plClient_RESOURCES}) + +add_dependencies(plClient externalResources) + if(PLASMA_EXTERNAL_RELEASE) set_target_properties(plClient PROPERTIES OUTPUT_NAME "UruExplorer") endif(PLASMA_EXTERNAL_RELEASE) diff --git a/Sources/Plasma/Apps/plClient/external/CMakeLists.txt b/Sources/Plasma/Apps/plClient/external/CMakeLists.txt new file mode 100644 index 00000000..7de07535 --- /dev/null +++ b/Sources/Plasma/Apps/plClient/external/CMakeLists.txt @@ -0,0 +1,30 @@ +set(external_SCRIPTS + makeres.py + render_svg.py + create_resource_dat.py +) + +set(external_SOURCES + Cursor_Base.svg + Linking_Book.svg + Loading_Text_rasterfont.svg + Voice_Chat.svg +) + +if(PLASMA_EXTERNAL_RELEASE) + set(Make_Resource_Command + python ${CMAKE_CURRENT_SOURCE_DIR}/makeres.py --optimize --render --package -i ${CMAKE_CURRENT_SOURCE_DIR} -o ${CMAKE_CURRENT_BINARY_DIR}) +else(PLASMA_EXTERNAL_RELEASE) + set(Make_Resource_Command + python ${CMAKE_CURRENT_SOURCE_DIR}/makeres.py --render --package -i ${CMAKE_CURRENT_SOURCE_DIR} -o ${CMAKE_CURRENT_BINARY_DIR}) +endif(PLASMA_EXTERNAL_RELEASE) + +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/resource.dat + COMMAND ${Make_Resource_Command} + DEPENDS ${external_SOURCES} ${external_SCRIPTS} +) +add_custom_target(externalResources DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/resource.dat) + +source_group("Source Files" FILES ${external_SOURCES}) +source_group("Script Files" FILES ${external_SCRIPTS}) diff --git a/Sources/Plasma/Apps/plClient/external/Cursor_Base.svg b/Sources/Plasma/Apps/plClient/external/Cursor_Base.svg new file mode 100644 index 00000000..737abfec --- /dev/null +++ b/Sources/Plasma/Apps/plClient/external/Cursor_Base.svg @@ -0,0 +1,383 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sources/Plasma/Apps/plClient/external/Linking_Book.svg b/Sources/Plasma/Apps/plClient/external/Linking_Book.svg new file mode 100644 index 00000000..628b8b55 --- /dev/null +++ b/Sources/Plasma/Apps/plClient/external/Linking_Book.svg @@ -0,0 +1,508 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sources/Plasma/Apps/plClient/external/Loading_Text_rasterfont.svg b/Sources/Plasma/Apps/plClient/external/Loading_Text_rasterfont.svg new file mode 100644 index 00000000..e93bdcbb --- /dev/null +++ b/Sources/Plasma/Apps/plClient/external/Loading_Text_rasterfont.svg @@ -0,0 +1,207 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sources/Plasma/Apps/plClient/external/Voice_Chat.svg b/Sources/Plasma/Apps/plClient/external/Voice_Chat.svg new file mode 100644 index 00000000..42ae5ceb --- /dev/null +++ b/Sources/Plasma/Apps/plClient/external/Voice_Chat.svg @@ -0,0 +1,1595 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sources/Plasma/Apps/plClient/external/create_resource_dat.py b/Sources/Plasma/Apps/plClient/external/create_resource_dat.py new file mode 100644 index 00000000..50374346 --- /dev/null +++ b/Sources/Plasma/Apps/plClient/external/create_resource_dat.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python + +from __future__ import print_function +from __future__ import with_statement + +import os +import sys +import glob +import struct +from optparse import OptionParser + +version = 1 + +def create_resource_dat(resfilepath, inrespath): + datHeader = 0xCBBCF00D + datVersion = 0x00000001 + + ## Get list of files to archive + resourceList = glob.glob(os.path.join(inrespath, "*")) + resourceList.sort() + if len(resourceList) == 0: + print("No files found in '{0}'. Quitting.\n".format(inrespath)) + return False + print("{0} resources found in '{1}'.".format(len(resourceList), inrespath, )) + + ## Write each resource into the output file + with open(resfilepath, "wb") as datFile: + datFile.write(struct.pack("