30 Commits

Author SHA1 Message Date
Thomas Edvalson 6ae6326595 Add missing sdmc check in emu getFilePath 2016-08-13 17:00:12 -04:00
Thomas Edvalson 13fb9ddc4d Send 0-len callback on HTTP failure. Add Keep-Alive header. 2016-08-13 01:55:26 -04:00
Thomas Edvalson 54dc1583aa Forgot to add scissor rect to cache 2016-08-10 22:30:59 -04:00
Thomas Edvalson 44c33d2f07 Add scissor rect to RenderState 2016-08-07 20:42:22 -04:00
Thomas Edvalson 47d3421fc0 Disable hardware texture tiling until bug is figured out 2016-08-03 03:39:47 -04:00
Thomas Edvalson 8109485489 Remove some unneeded legacy code 2016-08-03 03:14:51 -04:00
Thomas Edvalson 891e2dce18 Add TimedOut error code and some HTTP error handling 2016-08-03 03:14:08 -04:00
Thomas Edvalson 49b368e352 Fix missing emulator SSL code 2016-07-31 00:57:16 -04:00
Thomas Edvalson c897cd81a6 Add httpc timeouts. Fixes Cruel/freeShop#43 2016-07-31 00:54:23 -04:00
Thomas Edvalson 20345e31bc Fix Texture destructor bug that crashed when texture was empty 2016-07-25 05:13:04 -04:00
Thomas Edvalson 244fba8495 Change user-agent and httpc default proxy arg 2016-07-18 18:26:54 -04:00
Thomas Edvalson b92cc01559 Fix texture binding bug with system font 2016-07-18 18:22:59 -04:00
Thomas Edvalson 93210eb447 Add setRelativePriority to Thread and change SoundStream thread priority 2016-07-09 18:42:56 -04:00
Thomas Edvalson 8be4e6664c Bump 3ds-tools release version 2016-06-24 21:35:35 -04:00
Thomas Edvalson bfb17bec47 Add -D_3DS flags where necessary 2016-06-23 16:24:24 -04:00
Thomas Edvalson 845369632d Add codecov and badges 2016-06-14 19:34:05 -04:00
Thomas Edvalson aa18647d91 Use CMake FindVorbis 2016-06-13 13:36:42 -04:00
Thomas Edvalson a73da4c19e Add possible PORTLIBS override env variable 2016-06-13 02:40:07 -04:00
Thomas Edvalson b36b425915 Increase joystick threshold and ignore CFLAGS in 3DS cross compile 2016-06-12 14:20:14 -04:00
Thomas Edvalson ecaf2b50d9 Add cpp3ds-test lib 2016-06-10 22:48:27 -04:00
Thomas Edvalson 53eec38cc8 Get unit test framework working 2016-06-10 21:55:39 -04:00
Thomas Edvalson 2ef849024f Fix banner dependency in cmake 2016-06-06 01:30:21 -04:00
Thomas Edvalson 5c0cb16b60 Add HTTP::close() method for better httpc control 2016-06-06 00:50:52 -04:00
Thomas Edvalson 2167fa7917 Add option to use pre-built banner 2016-06-01 12:49:06 -04:00
Thomas Edvalson f44db4f01c Allow for custom http buffer size 2016-05-30 21:35:17 -04:00
Thomas Edvalson dbb9b597c8 Add version to CIA build and update README 2016-05-30 03:58:56 -04:00
Thomas Edvalson 5383cac7a8 Fix sound bug and remove unnecessary code 2016-05-30 01:41:31 -04:00
Thomas Edvalson e46d31acc7 Fix some HTTP errors
Don't close context until class is destroyed.
Increase field buffer length to 1024 (enough?)
2016-05-28 18:30:32 -04:00
Thomas Edvalson e87d589154 Add system font 2016-05-28 12:06:05 -04:00
Thomas Edvalson 0c01a02baf Update FBI sendfile script for 2.x protocol 2016-05-27 14:28:58 -04:00
43 changed files with 668 additions and 175 deletions
+2
View File
@@ -1,6 +1,7 @@
#!/bin/sh #!/bin/sh
set -ex set -ex
# Copy all files needed in cpp3ds archive
mkdir -p $CPP3DS/bin/ mkdir -p $CPP3DS/bin/
cp $DEVKITARM/bin/makerom $CPP3DS/bin/ cp $DEVKITARM/bin/makerom $CPP3DS/bin/
cp $DEVKITARM/bin/3dsxtool $CPP3DS/bin/ cp $DEVKITARM/bin/3dsxtool $CPP3DS/bin/
@@ -8,4 +9,5 @@ cp $DEVKITARM/bin/bannertool $CPP3DS/bin/
cp $DEVKITARM/bin/nihstro-assemble $CPP3DS/bin/ cp $DEVKITARM/bin/nihstro-assemble $CPP3DS/bin/
cp -r $PORTLIBS/lib/ $CPP3DS cp -r $PORTLIBS/lib/ $CPP3DS
cp -r $PORTLIBS/include/ $CPP3DS cp -r $PORTLIBS/include/ $CPP3DS
tar -cJvf $1 cpp3ds tar -cJvf $1 cpp3ds
+5 -1
View File
@@ -12,9 +12,13 @@ script:
before_deploy: before_deploy:
- export RELEASE_FILENAME=cpp3ds-$TRAVIS_OS_NAME-$TRAVIS_TAG.tar.xz - export RELEASE_FILENAME=cpp3ds-$TRAVIS_OS_NAME-$TRAVIS_TAG.tar.xz
- docker run --rm -v "$PWD":/usr/build -w /opt cpp3ds sh /usr/build/.build.sh /usr/build/$RELEASE_FILENAME - docker run --rm -v "$PWD":/usr/build -w /usr/src cpp3ds sh /usr/build/.build.sh /usr/build/$RELEASE_FILENAME
- sudo chmod 777 $RELEASE_FILENAME - sudo chmod 777 $RELEASE_FILENAME
after_success:
- docker run --rm -v "$PWD":/usr/build -w /usr/src/cpp3ds cpp3ds cp -r . /usr/build
- bash <(curl -s https://codecov.io/bash)
deploy: deploy:
provider: releases provider: releases
api_key: api_key:
+7 -3
View File
@@ -9,6 +9,7 @@ include(cpp3ds)
option(BUILD_EMULATOR "Build cpp3ds emulator (Qt5 required)" ON) option(BUILD_EMULATOR "Build cpp3ds emulator (Qt5 required)" ON)
option(BUILD_EXAMPLES "Build all cpp3ds example projects" ON) option(BUILD_EXAMPLES "Build all cpp3ds example projects" ON)
option(BUILD_DOCS "Build doxygen documentation" OFF) option(BUILD_DOCS "Build doxygen documentation" OFF)
option(BUILD_TESTS "Build unit tests" OFF)
option(ENABLE_OGG "Include OGG encoder/decoder classes" ON) option(ENABLE_OGG "Include OGG encoder/decoder classes" ON)
option(ENABLE_FLAC "Include FLAC encoder/decoder classes" OFF) option(ENABLE_FLAC "Include FLAC encoder/decoder classes" OFF)
option(ENABLE_MP3 "Include MP3 decoder class" OFF) option(ENABLE_MP3 "Include MP3 decoder class" OFF)
@@ -72,14 +73,17 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin")
# compile flags # compile flags
set(ARCH "-march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft") set(ARCH "-march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft")
set(CPP3DS_ARM_FLAGS "-g -O2 ${ARCH} -ffunction-sections -fdata-sections") set(CPP3DS_ARM_FLAGS "-g -O2 ${ARCH} -ffunction-sections -fdata-sections")
set(CPP3DS_TEST_FLAGS "-g -O2") set(CPP3DS_TEST_FLAGS "-g -O2 -coverage")
set(CPP3DS_EMU_FLAGS "-g -O2") set(CPP3DS_EMU_FLAGS "-g -O2")
add_subdirectory(src)
if(BUILD_EXAMPLES) if(BUILD_EXAMPLES)
add_subdirectory(examples) add_subdirectory(examples)
endif() endif()
if(BUILD_DOCS) if(BUILD_DOCS)
add_subdirectory(doc) add_subdirectory(doc)
endif() endif()
if(BUILD_TESTS)
add_subdirectory(src) add_subdirectory(test)
endif()
+12 -10
View File
@@ -1,12 +1,13 @@
FROM thecruel/devkitarm-3ds:latest FROM thecruel/devkitarm-3ds:latest
MAINTAINER Thomas Edvalson "machin3@gmail.com" MAINTAINER Thomas Edvalson "machin3@gmail.com"
ENV CPP3DS /opt/cpp3ds ENV CPP3DS /usr/src/cpp3ds
COPY . /usr/src/cpp3ds COPY . /usr/src/cpp3ds
WORKDIR /usr/src WORKDIR /usr/src
RUN apt-get update && apt-get -y install \ RUN apt-get update && apt-get -y install \
libgtest-dev \
libsfml-dev \ libsfml-dev \
libglew-dev \ libglew-dev \
qt5-default \ qt5-default \
@@ -24,21 +25,22 @@ RUN wget -q https://github.com/cpp3ds/3ds_portlibs/releases/download/r3/portlibs
ln -s $(pwd)/portlibs $DEVKITPRO/portlibs && \ ln -s $(pwd)/portlibs $DEVKITPRO/portlibs && \
ln -s $DEVKITPRO/portlibs/3ds $DEVKITPRO/portlibs/armv6k ln -s $DEVKITPRO/portlibs/3ds $DEVKITPRO/portlibs/armv6k
RUN wget -q https://github.com/cpp3ds/3ds-tools/releases/download/r4/3ds-tools-linux-r4.tar.gz -O tools.tar.gz && \ RUN wget -q https://github.com/cpp3ds/3ds-tools/releases/download/r5/3ds-tools-linux-r5.tar.gz -O tools.tar.gz && \
tar -xaf tools.tar.gz && \ tar -xaf tools.tar.gz && \
cp 3ds-tools/* $DEVKITARM/bin && \ cp 3ds-tools/* $DEVKITARM/bin && \
rm tools.tar.gz rm tools.tar.gz
WORKDIR /usr/src/gtest
RUN cmake . && \
make -j4 && \
cp *.a /usr/lib && \
make clean
WORKDIR /usr/src/cpp3ds WORKDIR /usr/src/cpp3ds
RUN mkdir build && \ RUN mkdir build && \
cd build && \ cd build && \
cmake -DBUILD_EMULATOR=ON -DENABLE_OGG=ON -DBUILD_EXAMPLES=OFF .. && \ cmake -DBUILD_EMULATOR=ON -DENABLE_OGG=ON -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=ON .. && \
make -j4 && \ make -j4 && \
mv lib .. && \
cd .. && \ cd .. && \
mkdir $CPP3DS && \ ./bin/tests
cp -r build/lib $CPP3DS && \
cp -r include $CPP3DS && \
cp -r cmake $CPP3DS && \
cp -r scripts $CPP3DS && \
cd .. && \
rm -r cpp3ds
+7 -3
View File
@@ -1,6 +1,8 @@
cpp3ds [![Build Status](https://travis-ci.org/cpp3ds/cpp3ds.png?branch=master)](https://travis-ci.org/cpp3ds/cpp3ds) cpp3ds
====== ======
[![Build Status](https://travis-ci.org/cpp3ds/cpp3ds.png?branch=master)](https://travis-ci.org/cpp3ds/cpp3ds) [![Codecov branch](https://img.shields.io/codecov/c/github/cpp3ds/cpp3ds/master.svg?maxAge=86400)](https://codecov.io/gh/cpp3ds/cpp3ds) [![Docker pulls](https://img.shields.io/docker/pulls/thecruel/cpp3ds.svg?maxAge=86400)](https://hub.docker.com/r/thecruel/cpp3ds/) [![AUR package](https://img.shields.io/aur/version/cpp3ds-git.svg?maxAge=86400)](https://aur.archlinux.org/packages/cpp3ds-git/)
Basic C++ gaming framework and library for Nintendo 3DS. Basic C++ gaming framework and library for Nintendo 3DS.
cpp3ds is essentially a barebones port of SFML with a parallel native 3ds emulator built on top of it. The goal is to completely abstract the developer from the hardware SDK and provide a nice object-oriented C++ framework for clean and easy coding. And the emulator is designed to provide a means of surface-level realtime debugging (with GDB or whatever you prefer). cpp3ds is essentially a barebones port of SFML with a parallel native 3ds emulator built on top of it. The goal is to completely abstract the developer from the hardware SDK and provide a nice object-oriented C++ framework for clean and easy coding. And the emulator is designed to provide a means of surface-level realtime debugging (with GDB or whatever you prefer).
@@ -20,12 +22,14 @@ Requirements
- DevkitARM - DevkitARM
- ctrulib - ctrulib
- [gl3ds](https://github.com/cpp3ds/gl3ds) - citro3d
For emulator: For emulator:
- [SFML 2.1](http://www.sfml-dev.org/index.php) - [SFML 2.3](http://www.sfml-dev.org/index.php)
- [Qt 5](https://qt-project.org/) - [Qt 5](https://qt-project.org/)
- OpenAL
- libvorbis
For unit tests: For unit tests:
+1 -1
View File
@@ -9,7 +9,7 @@ SET(CMAKE_OBJCOPY ${DEVKITARM}/bin/arm-none-eabi-objcopy)
SET(CMAKE_AR ${DEVKITARM}/bin/arm-none-eabi-ar) SET(CMAKE_AR ${DEVKITARM}/bin/arm-none-eabi-ar)
SET(CMAKE_RANLIB ${DEVKITARM}/bin/arm-none-eabi-ranlib) SET(CMAKE_RANLIB ${DEVKITARM}/bin/arm-none-eabi-ranlib)
set(CMAKE_FIND_ROOT_PATH ${DEVKITARM} ${DEVKITPRO} ${DEVKITPRO}/portlibs/3ds ${DEVKITPRO}/portlibs/armv6k) set(CMAKE_FIND_ROOT_PATH $ENV{PORTLIBS}/3ds $ENV{PORTLIBS}/armv6k ${DEVKITARM} ${DEVKITPRO} ${DEVKITPRO}/portlibs/3ds ${DEVKITPRO}/portlibs/armv6k)
# adjust the default behaviour of the FIND_XXX() commands: # adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search # search headers and libraries in the target environment, search
# programs in the host environment # programs in the host environment
+11 -12
View File
@@ -302,16 +302,8 @@ function(__add_ncch_banner target IMAGE SOUND)
endfunction() endfunction()
function(add_cia_target target RSF IMAGE SOUND ) function(add_cia_target target RSF IMAGE SOUND)
get_filename_component(target_we ${target} NAME_WE) get_filename_component(target_we ${target} NAME_WE)
if(${ARGC} GREATER 6)
set(APP_TITLE ${ARGV4})
set(APP_DESCRIPTION ${ARGV5})
set(APP_AUTHOR ${ARGV6})
endif()
if(${ARGC} EQUAL 8)
set(APP_ICON ${ARGV7})
endif()
if(NOT APP_TITLE) if(NOT APP_TITLE)
set(APP_TITLE ${target}) set(APP_TITLE ${target})
endif() endif()
@@ -321,6 +313,9 @@ function(add_cia_target target RSF IMAGE SOUND )
if(NOT APP_AUTHOR) if(NOT APP_AUTHOR)
set(APP_AUTHOR "Unspecified Author") set(APP_AUTHOR "Unspecified Author")
endif() endif()
if(NOT APP_VERSION)
set(APP_VERSION 0)
endif()
if(NOT APP_ICON) if(NOT APP_ICON)
if(EXISTS ${target}.png) if(EXISTS ${target}.png)
set(APP_ICON ${target}.png) set(APP_ICON ${target}.png)
@@ -335,7 +330,10 @@ function(add_cia_target target RSF IMAGE SOUND )
if( NOT ${target_we}.smdh) if( NOT ${target_we}.smdh)
__add_smdh(${target_we}.smdh ${APP_TITLE} ${APP_DESCRIPTION} ${APP_AUTHOR} ${APP_ICON}) __add_smdh(${target_we}.smdh ${APP_TITLE} ${APP_DESCRIPTION} ${APP_AUTHOR} ${APP_ICON})
endif() endif()
__add_ncch_banner(${target_we}.bnr ${IMAGE} ${SOUND}) if(NOT BANNER)
set(BANNER ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.bnr)
__add_ncch_banner(${target_we}.bnr ${IMAGE} ${SOUND})
endif()
add_custom_command(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.cia add_custom_command(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.cia
COMMAND ${MAKEROM} -f cia COMMAND ${MAKEROM} -f cia
-target t -target t
@@ -343,12 +341,13 @@ function(add_cia_target target RSF IMAGE SOUND )
-o ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.cia -o ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.cia
-elf $<TARGET_FILE:${target}> -elf $<TARGET_FILE:${target}>
-rsf ${RSF} -rsf ${RSF}
-banner ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.bnr -ver ${APP_VERSION}
-banner ${BANNER}
-icon ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.smdh -icon ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.smdh
-DAPP_TITLE=${APP_TITLE} -DAPP_TITLE=${APP_TITLE}
-DAPP_PRODUCT_CODE=${APP_PRODUCT_CODE} -DAPP_PRODUCT_CODE=${APP_PRODUCT_CODE}
-DAPP_UNIQUE_ID=${APP_UNIQUE_ID} -DAPP_UNIQUE_ID=${APP_UNIQUE_ID}
DEPENDS ${target} ${RSF} ${ROMFS_FILES} ${SHADER_OUTPUT} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.bnr ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.smdh DEPENDS ${target} ${RSF} ${ROMFS_FILES} ${SHADER_OUTPUT} ${BANNER} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.smdh
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
VERBATIM VERBATIM
) )
+1
View File
@@ -27,6 +27,7 @@ file(GLOB_RECURSE ROMFS_FILES ${PROJECT_SOURCE_DIR}/res/romfs/*)
add_executable(${PROJECT_NAME}.elf ${SOURCE_FILES} ${ARM_SOURCE_FILES}) add_executable(${PROJECT_NAME}.elf ${SOURCE_FILES} ${ARM_SOURCE_FILES})
target_link_libraries(${PROJECT_NAME}.elf ${CPP3DS_ARM_LIBS}) target_link_libraries(${PROJECT_NAME}.elf ${CPP3DS_ARM_LIBS})
set_target_properties(${PROJECT_NAME}.elf PROPERTIES COMPILE_DEFINITIONS "_3DS")
set_target_properties(${PROJECT_NAME}.elf PROPERTIES COMPILE_FLAGS "${CPP3DS_ARM_FLAGS}") set_target_properties(${PROJECT_NAME}.elf PROPERTIES COMPILE_FLAGS "${CPP3DS_ARM_FLAGS}")
set_target_properties(${PROJECT_NAME}.elf PROPERTIES LINK_FLAGS "-specs=3dsx.specs -march=armv6k -mtune=mpcore -mfloat-abi=hard -gc-sections") set_target_properties(${PROJECT_NAME}.elf PROPERTIES LINK_FLAGS "-specs=3dsx.specs -march=armv6k -mtune=mpcore -mfloat-abi=hard -gc-sections")
SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
+9 -2
View File
@@ -1,9 +1,16 @@
#ifndef CPP3DS_EMULATOR_HPP #ifndef CPP3DS_EMULATOR_HPP
#define CPP3DS_EMULATOR_HPP #define CPP3DS_EMULATOR_HPP
#include <cpp3ds/Config.hpp> #ifdef TEST
#include <cpp3ds/Emulator/Emulator.hpp> #include <SFML/Graphics.hpp>
#else
#include <cpp3ds/Config.hpp>
#include <cpp3ds/Emulator/Emulator.hpp>
#endif
#endif #endif
+5 -4
View File
@@ -187,13 +187,14 @@ bool operator !=(const Rect<T>& left, const Rect<T>& right);
#include <cpp3ds/Graphics/Rect.inl> #include <cpp3ds/Graphics/Rect.inl>
// Create typedefs for the most common types // Create typedefs for the most common types
typedef Rect<int> IntRect; typedef Rect<int> IntRect;
typedef Rect<float> FloatRect; typedef Rect<size_t> UintRect;
typedef Rect<float> FloatRect;
} // namespace sf } // namespace cpp3ds
#endif // SFML_RECT_HPP #endif // CPP3DS_RECT_HPP
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
+10 -1
View File
@@ -91,6 +91,14 @@ public :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
RenderStates(const Shader* theShader); RenderStates(const Shader* theShader);
////////////////////////////////////////////////////////////
/// \brief Construct a default set of render states with a custom scissor
///
/// \param theScissor Scissor rect to use
///
////////////////////////////////////////////////////////////
RenderStates(const UintRect& theScissor);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Construct a set of render states with all its attributes /// \brief Construct a set of render states with all its attributes
/// ///
@@ -101,7 +109,7 @@ public :
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
RenderStates(const BlendMode& theBlendMode, const Transform& theTransform, RenderStates(const BlendMode& theBlendMode, const Transform& theTransform,
const Texture* theTexture, const Shader* theShader); const Texture* theTexture, const Shader* theShader, const IntRect& theScissor);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Static member data // Static member data
@@ -115,6 +123,7 @@ public :
Transform transform; ///< Transform Transform transform; ///< Transform
const Texture* texture; ///< Texture const Texture* texture; ///< Texture
const Shader* shader; ///< Shader const Shader* shader; ///< Shader
UintRect scissor; ///< Scissor
}; };
} }
+11
View File
@@ -49,6 +49,8 @@ class Drawable;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class RenderTarget : NonCopyable class RenderTarget : NonCopyable
{ {
friend class Text;
public : public :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@@ -359,6 +361,14 @@ private:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void applyBlendMode(const BlendMode& mode); void applyBlendMode(const BlendMode& mode);
////////////////////////////////////////////////////////////
/// \brief Apply a new scissor rect
///
/// \param rect Scissor rect to use (Empty IntRect() to disable)
///
////////////////////////////////////////////////////////////
void applyScissor(const UintRect& rect);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Apply a new transform /// \brief Apply a new transform
/// ///
@@ -411,6 +421,7 @@ private:
Uint64 lastTextureId; ///< Cached texture Uint64 lastTextureId; ///< Cached texture
bool useVertexCache; ///< Did we previously use the vertex cache? bool useVertexCache; ///< Did we previously use the vertex cache?
Vertex* vertexCache; ///< Pre-transformed vertices cache Vertex* vertexCache; ///< Pre-transformed vertices cache
UintRect lastScissor;
}; };
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
+12
View File
@@ -40,6 +40,7 @@
namespace cpp3ds namespace cpp3ds
{ {
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Graphical text that can be drawn to a render target /// \brief Graphical text that can be drawn to a render target
/// ///
@@ -124,6 +125,8 @@ namespace cpp3ds
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void setFont(const Font& font); void setFont(const Font& font);
void useSystemFont();
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Set the character size /// \brief Set the character size
/// ///
@@ -337,6 +340,8 @@ namespace cpp3ds
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
virtual void draw(RenderTarget& target, RenderStates states) const; virtual void draw(RenderTarget& target, RenderStates states) const;
void drawSystemFont(RenderTarget& target, RenderStates states) const;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Make sure the text's geometry is updated /// \brief Make sure the text's geometry is updated
/// ///
@@ -346,6 +351,9 @@ namespace cpp3ds
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void ensureGeometryUpdate() const; void ensureGeometryUpdate() const;
void ensureGeometryUpdateSystemFont() const;
Vector2f findCharacterPosSystemFont(std::size_t index) const;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Member data // Member data
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@@ -360,6 +368,10 @@ namespace cpp3ds
mutable VertexArray m_outlineVertices; ///< Vertex array containing the outline geometry mutable VertexArray m_outlineVertices; ///< Vertex array containing the outline geometry
mutable FloatRect m_bounds; ///< Bounding rectangle of the text (in local coordinates) mutable FloatRect m_bounds; ///< Bounding rectangle of the text (in local coordinates)
mutable bool m_geometryNeedUpdate; ///< Does the geometry need to be recomputed? mutable bool m_geometryNeedUpdate; ///< Does the geometry need to be recomputed?
bool m_useSystemFont; ///< Flag to use 3DS system font
#ifndef EMULATION
mutable std::vector<Uint16> m_systemGlyphTextures;
#endif
}; };
} // namespace cpp3ds } // namespace cpp3ds
+8 -3
View File
@@ -231,7 +231,8 @@ public:
// 10xx: cpp3ds custom codes // 10xx: cpp3ds custom codes
InvalidResponse = 1000, ///< Response is not a valid HTTP one InvalidResponse = 1000, ///< Response is not a valid HTTP one
ConnectionFailed = 1001 ///< Connection with server failed ConnectionFailed = 1001, ///< Connection with server failed
TimedOut = 1002, ///< Connection timed out
}; };
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@@ -319,7 +320,7 @@ public:
#ifdef EMULATION #ifdef EMULATION
void parse(const std::string& data); void parse(const std::string& data);
#else #else
void parse(httpcContext *context); void parse(httpcContext *context, Time timeout);
#endif #endif
@@ -362,6 +363,10 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Http(); Http();
~Http();
void close();
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Construct the HTTP client with the target host /// \brief Construct the HTTP client with the target host
/// ///
@@ -413,7 +418,7 @@ public:
/// \return Server's response /// \return Server's response
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Response sendRequest(const Request& request, Time timeout = Time::Zero, RequestCallback callback = nullptr); Response sendRequest(const Request& request, Time timeout = Time::Zero, RequestCallback callback = nullptr, size_t bufferSize = 4096);
private: private:
+1 -3
View File
@@ -23,9 +23,7 @@ namespace {
std::unique_ptr<char[]> buf( new char[ size ] ); std::unique_ptr<char[]> buf( new char[ size ] );
snprintf( buf.get(), size, format.c_str(), args ... ); snprintf( buf.get(), size, format.c_str(), args ... );
std::string stringUtf8( buf.get(), buf.get() + size - 1 ); // We don't want the '\0' inside std::string stringUtf8( buf.get(), buf.get() + size - 1 ); // We don't want the '\0' inside
std::wstring stringUtf32; return cpp3ds::String::fromUtf8(stringUtf8.begin(), stringUtf8.end());
cpp3ds::Utf8::toUtf32(stringUtf8.begin(), stringUtf8.end(), std::back_inserter(stringUtf32));
return cpp3ds::String(stringUtf32);
} }
} }
+1
View File
@@ -177,6 +177,7 @@ public :
void setStackSize(size_t stacksize); void setStackSize(size_t stacksize);
void setPriority(int priority); void setPriority(int priority);
void setRelativePriority(int priority);
void setAffinity(int affinity); void setAffinity(int affinity);
private : private :
+10 -7
View File
@@ -3,16 +3,19 @@ import os, socket, sys, struct, getopt
def sendfile(filename, ip): def sendfile(filename, ip):
statinfo = os.stat(filename) statinfo = os.stat(filename)
fbiinfo = struct.pack('!q', statinfo.st_size)
with open(filename, 'rb') as f: with open(filename, 'rb') as f:
sock = socket.socket() sock = socket.socket()
sock.connect((ip, 5000)) sock.connect((ip, 5000))
sock.send(fbiinfo) sock.send(struct.pack('!i', 1))
while True: if struct.unpack("!b", sock.recv(1))[0] == 1:
chunk = f.read(16384) sock.send(struct.pack('!q', statinfo.st_size))
if not chunk: while True:
break # EOF chunk = f.read(1024 * 256)
sock.sendall(chunk) if not chunk:
break # EOF
sock.sendall(chunk)
else:
print("Canceled by FBI")
sock.close() sock.close()
def show_usage_exit(): def show_usage_exit():
+2
View File
@@ -17,6 +17,8 @@ set(SRC
) )
if(ENABLE_OGG) if(ENABLE_OGG)
find_package(Vorbis REQUIRED)
include_directories(${VORBIS_INCLUDE_DIRS})
list(APPEND SRC list(APPEND SRC
${SRCROOT}/SoundFileReaderOgg.cpp ${SRCROOT}/SoundFileReaderOgg.cpp
${SRCROOT}/SoundFileWriterOgg.cpp) ${SRCROOT}/SoundFileWriterOgg.cpp)
+2 -2
View File
@@ -144,7 +144,7 @@ void Sound::setBuffer(const SoundBuffer& buffer)
memset(&m_ndspWaveBuf, 0, sizeof(ndspWaveBuf)); memset(&m_ndspWaveBuf, 0, sizeof(ndspWaveBuf));
m_ndspWaveBuf.data_vaddr = buffer.getSamples(); m_ndspWaveBuf.data_vaddr = buffer.getSamples();
m_ndspWaveBuf.nsamples = buffer.getSampleCount(); m_ndspWaveBuf.nsamples = buffer.getSampleCount() / buffer.getChannelCount();
m_ndspWaveBuf.looping = m_loop; // Loop enabled m_ndspWaveBuf.looping = m_loop; // Loop enabled
m_ndspWaveBuf.status = NDSP_WBUF_FREE; m_ndspWaveBuf.status = NDSP_WBUF_FREE;
@@ -184,7 +184,7 @@ void Sound::setPlayingOffset(Time timeOffset)
m_playOffset = timeOffset; m_playOffset = timeOffset;
int offset = m_buffer->getSampleRate() * m_buffer->getChannelCount() * timeOffset.asSeconds(); int offset = m_buffer->getSampleRate() * m_buffer->getChannelCount() * timeOffset.asSeconds();
m_ndspWaveBuf.data_vaddr = m_buffer->getSamples() + offset; m_ndspWaveBuf.data_vaddr = m_buffer->getSamples() + offset;
m_ndspWaveBuf.nsamples = m_buffer->getSampleCount() - offset; m_ndspWaveBuf.nsamples = m_buffer->getSampleCount() / m_buffer->getChannelCount() - offset;
if (status == Playing) if (status == Playing)
ndspChnWaveBufAdd(m_channel, &m_ndspWaveBuf); ndspChnWaveBufAdd(m_channel, &m_ndspWaveBuf);
} }
+1 -1
View File
@@ -46,7 +46,7 @@ SoundStream::SoundStream()
, m_loop (false) , m_loop (false)
, m_samplesProcessed(0) , m_samplesProcessed(0)
{ {
m_thread.setPriority(0x19);
} }

Some files were not shown because too many files have changed in this diff Show More