Merge commit '2d3aa03'

This commit is contained in:
Phillip 2016-05-20 20:11:15 -07:00
commit d06fa3f0dc
3 changed files with 28 additions and 10 deletions

View File

@ -9,9 +9,25 @@
#include <string.h> #include <string.h>
#include <thread> #include <thread>
#include <map> #include <map>
#include <varargs.h>
static logvisor::Module Log("amuseplay"); static logvisor::Module Log("amuseplay");
#if __GNUC__
__attribute__((__format__ (__printf__, 3, 4)))
#endif
static inline void SNPrintf(boo::SystemChar* str, size_t maxlen, const boo::SystemChar* format, ...)
{
va_list va;
va_start(va, format);
#if _WIN32
_vsnwprintf(str, maxlen, format, va);
#else
vsnprintf(str, maxlen, format, va);
#endif
va_end(va);
}
static amuse::IntrusiveAudioGroupData LoadFromArgs(int argc, const boo::SystemChar** argv, static amuse::IntrusiveAudioGroupData LoadFromArgs(int argc, const boo::SystemChar** argv,
std::string& descOut, bool& good) std::string& descOut, bool& good)
{ {
@ -66,14 +82,14 @@ static amuse::IntrusiveAudioGroupData LoadFromArgs(int argc, const boo::SystemCh
else else
{ {
/* Now attempt multi-file case */ /* Now attempt multi-file case */
char path[1024]; boo::SystemChar path[1024];
/* Project */ /* Project */
snprintf(path, 1024, "%s.pro", argv[1]); SNPrintf(path, 1024, _S("%s.pro"), argv[1]);
r.emplace(path, 32 * 1024, false); r.emplace(path, 32 * 1024, false);
if (r->hasError()) if (r->hasError())
{ {
snprintf(path, 1024, "%s.proj", argv[1]); SNPrintf(path, 1024, _S("%s.proj"), argv[1]);
r.emplace(path, 32 * 1024, false); r.emplace(path, 32 * 1024, false);
if (r->hasError()) if (r->hasError())
return {nullptr, nullptr, nullptr, nullptr}; return {nullptr, nullptr, nullptr, nullptr};
@ -81,11 +97,11 @@ static amuse::IntrusiveAudioGroupData LoadFromArgs(int argc, const boo::SystemCh
std::unique_ptr<uint8_t[]> proj = r->readUBytes(r->length()); std::unique_ptr<uint8_t[]> proj = r->readUBytes(r->length());
/* Pool */ /* Pool */
snprintf(path, 1024, "%s.poo", argv[1]); SNPrintf(path, 1024, _S("%s.poo"), argv[1]);
r.emplace(path, 32 * 1024, false); r.emplace(path, 32 * 1024, false);
if (r->hasError()) if (r->hasError())
{ {
snprintf(path, 1024, "%s.pool", argv[1]); SNPrintf(path, 1024, _S("%s.pool"), argv[1]);
r.emplace(path, 32 * 1024, false); r.emplace(path, 32 * 1024, false);
if (r->hasError()) if (r->hasError())
return {nullptr, nullptr, nullptr, nullptr}; return {nullptr, nullptr, nullptr, nullptr};
@ -93,11 +109,11 @@ static amuse::IntrusiveAudioGroupData LoadFromArgs(int argc, const boo::SystemCh
std::unique_ptr<uint8_t[]> pool = r->readUBytes(r->length()); std::unique_ptr<uint8_t[]> pool = r->readUBytes(r->length());
/* Sdir */ /* Sdir */
snprintf(path, 1024, "%s.sdi", argv[1]); SNPrintf(path, 1024, _S("%s.sdi"), argv[1]);
r.emplace(path, 32 * 1024, false); r.emplace(path, 32 * 1024, false);
if (r->hasError()) if (r->hasError())
{ {
snprintf(path, 1024, "%s.sdir", argv[1]); SNPrintf(path, 1024, _S("%s.sdir"), argv[1]);
r.emplace(path, 32 * 1024, false); r.emplace(path, 32 * 1024, false);
if (r->hasError()) if (r->hasError())
return {nullptr, nullptr, nullptr, nullptr}; return {nullptr, nullptr, nullptr, nullptr};
@ -105,11 +121,11 @@ static amuse::IntrusiveAudioGroupData LoadFromArgs(int argc, const boo::SystemCh
std::unique_ptr<uint8_t[]> sdir = r->readUBytes(r->length()); std::unique_ptr<uint8_t[]> sdir = r->readUBytes(r->length());
/* Samp */ /* Samp */
snprintf(path, 1024, "%s.sam", argv[1]); SNPrintf(path, 1024, _S("%s.sam"), argv[1]);
r.emplace(path, 32 * 1024, false); r.emplace(path, 32 * 1024, false);
if (r->hasError()) if (r->hasError())
{ {
snprintf(path, 1024, "%s.samp", argv[1]); SNPrintf(path, 1024, _S("%s.samp"), argv[1]);
r.emplace(path, 32 * 1024, false); r.emplace(path, 32 * 1024, false);
if (r->hasError()) if (r->hasError())
return {nullptr, nullptr, nullptr, nullptr}; return {nullptr, nullptr, nullptr, nullptr};
@ -640,7 +656,7 @@ struct AppCallback : boo::IApplicationCallback
int appMain(boo::IApplication* app) int appMain(boo::IApplication* app)
{ {
/* Event window */ /* Event window */
m_win = app->newWindow("amuseplay", 1); m_win = app->newWindow(_S("amuseplay"), 1);
m_win->setCallback(&m_events); m_win->setCallback(&m_events);
m_win->setWindowFrame(100, 100, 100, 100); m_win->setWindowFrame(100, 100, 100, 100);
m_win->setStyle(~boo::EWindowStyle::Resize); m_win->setStyle(~boo::EWindowStyle::Resize);

View File

@ -3,6 +3,7 @@
#include <stdint.h> #include <stdint.h>
#include <vector> #include <vector>
#include <array>
#include <list> #include <list>
#include "optional.hpp" #include "optional.hpp"
#include "Entity.hpp" #include "Entity.hpp"

View File

@ -1,5 +1,6 @@
#include "amuse/SurroundProfiles.hpp" #include "amuse/SurroundProfiles.hpp"
#include <cmath> #include <cmath>
#include <algorithm>
#include <cfloat> #include <cfloat>
namespace amuse namespace amuse