mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Merge branch '12.0' into GraphicsBuffer
This commit is contained in:
@@ -113,15 +113,18 @@ void Module::registerInstance(Module *instance)
|
||||
|
||||
registry.insert(make_pair(name, instance));
|
||||
|
||||
ModuleType moduletype = instance->getModuleType();
|
||||
ModuleType mtype = instance->getModuleType();
|
||||
|
||||
if (instances[moduletype] != nullptr)
|
||||
if (mtype != M_UNKNOWN)
|
||||
{
|
||||
printf("Warning: overwriting module instance %s with new instance %s\n",
|
||||
instances[moduletype]->getName(), instance->getName());
|
||||
}
|
||||
if (instances[mtype] != nullptr)
|
||||
{
|
||||
printf("Warning: overwriting module instance %s with new instance %s\n",
|
||||
instances[mtype]->getName(), instance->getName());
|
||||
}
|
||||
|
||||
instances[moduletype] = instance;
|
||||
instances[mtype] = instance;
|
||||
}
|
||||
}
|
||||
|
||||
Module *Module::getInstance(const std::string &name)
|
||||
|
||||
+2
-1
@@ -38,6 +38,7 @@ public:
|
||||
|
||||
enum ModuleType
|
||||
{
|
||||
M_UNKNOWN = -1, // Use this for modules outside of LOVE's source code.
|
||||
M_AUDIO,
|
||||
M_DATA,
|
||||
M_EVENT,
|
||||
@@ -99,7 +100,7 @@ public:
|
||||
template <typename T>
|
||||
static T *getInstance(ModuleType type)
|
||||
{
|
||||
return (T *) instances[type];
|
||||
return type != M_UNKNOWN ? (T *) instances[type] : nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
+11
-2
@@ -24,7 +24,9 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef LOVE_WINDOWS
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <malloc.h>
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <unistd.h> // Assume POSIX support.
|
||||
#endif
|
||||
@@ -54,8 +56,15 @@ void alignedFree(void *mem)
|
||||
size_t getPageSize()
|
||||
{
|
||||
#ifdef LOVE_WINDOWS
|
||||
// TODO: Do an actual query.
|
||||
return 4096;
|
||||
static DWORD size = 0;
|
||||
if (size == 0)
|
||||
{
|
||||
SYSTEM_INFO si;
|
||||
GetSystemInfo(&si);
|
||||
size = si.dwPageSize;
|
||||
}
|
||||
|
||||
return (size_t) size;
|
||||
#else
|
||||
static const long size = sysconf(_SC_PAGESIZE);
|
||||
return size > 0 ? (size_t) size : 4096;
|
||||
|
||||
+4304
-2174
File diff suppressed because it is too large
Load Diff
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
@@ -1,6 +1,6 @@
|
||||
# luasocket src/makefile
|
||||
#
|
||||
# Definitions in this section can be overriden on the command line or in the
|
||||
# Definitions in this section can be overridden on the command line or in the
|
||||
# environment.
|
||||
#
|
||||
# These are equivalent:
|
||||
|
||||
@@ -219,7 +219,7 @@ function send_message(mesgt)
|
||||
else send_string(mesgt) end
|
||||
end
|
||||
|
||||
-- set defaul headers
|
||||
-- set default headers
|
||||
local function adjust_headers(mesgt)
|
||||
local lower = lower_headers(mesgt.headers)
|
||||
lower["date"] = lower["date"] or
|
||||
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
@@ -34,7 +34,7 @@ namespace lullaby
|
||||
FLACDecoder::FLACDecoder(Data *data, int nbufferSize)
|
||||
: Decoder(data, nbufferSize)
|
||||
{
|
||||
flac = drflac_open_memory(data->getData(), data->getSize());
|
||||
flac = drflac_open_memory(data->getData(), data->getSize(), nullptr);
|
||||
if (flac == nullptr)
|
||||
throw love::Exception("Could not load FLAC file");
|
||||
}
|
||||
@@ -52,7 +52,7 @@ bool FLACDecoder::accepts(const std::string &ext)
|
||||
// Please remove once it's no longer the case.
|
||||
static const std::string supported[] =
|
||||
{
|
||||
"flac", "ogg"
|
||||
"flac", "ogg", ""
|
||||
};
|
||||
|
||||
for (int i = 0; !(supported[i].empty()); i++)
|
||||
@@ -125,4 +125,3 @@ double FLACDecoder::getDuration()
|
||||
} // lullaby
|
||||
} // sound
|
||||
} // love
|
||||
|
||||
|
||||
Reference in New Issue
Block a user