~ only set default values if using localSharedMemory
This commit is contained in:
parent
12b8c74330
commit
f231598aa0
@ -19,8 +19,6 @@ namespace vkvm {
|
|||||||
int semId;
|
int semId;
|
||||||
struct sembuf semaphore;
|
struct sembuf semaphore;
|
||||||
|
|
||||||
std::vector<char> localSharedMemory;
|
|
||||||
|
|
||||||
auto initSemaphore() -> int {
|
auto initSemaphore() -> int {
|
||||||
/* Testen, ob das Semaphor bereits existiert */
|
/* Testen, ob das Semaphor bereits existiert */
|
||||||
semId = semget(SEM_KEY, 0, IPC_PRIVATE);
|
semId = semget(SEM_KEY, 0, IPC_PRIVATE);
|
||||||
@ -64,11 +62,11 @@ namespace vkvm {
|
|||||||
givenWarning = true;
|
givenWarning = true;
|
||||||
log(LogLevel::WARNING, "no shared memory found, using local memory instead!");
|
log(LogLevel::WARNING, "no shared memory found, using local memory instead!");
|
||||||
}
|
}
|
||||||
if (localSharedMemory.empty()) {
|
if (impl.localSharedMemory.empty()) {
|
||||||
constexpr int kilo = 1024;
|
constexpr int kilo = 1024;
|
||||||
localSharedMemory.resize(impl.sharedMemorySize * kilo);
|
impl.localSharedMemory.resize(impl.sharedMemorySize * kilo);
|
||||||
}
|
}
|
||||||
return &localSharedMemory[0];
|
return &impl.localSharedMemory[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
auto getSharedMemory() -> char * {
|
auto getSharedMemory() -> char * {
|
||||||
|
@ -11,6 +11,11 @@ namespace vkvm {
|
|||||||
auto setDefaultValues() -> void {
|
auto setDefaultValues() -> void {
|
||||||
impl.localMemoryWarn = false;
|
impl.localMemoryWarn = false;
|
||||||
if (getSharedMemory() != nullptr) {
|
if (getSharedMemory() != nullptr) {
|
||||||
|
if (!impl.localSharedMemory.empty()) {
|
||||||
|
if(getSharedMemory() == &impl.localSharedMemory[0]){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
setMode(GraphicMode::RGB);
|
setMode(GraphicMode::RGB);
|
||||||
setCharactersPerRow(60);
|
setCharactersPerRow(60);
|
||||||
setCharactersPerColumn(20);
|
setCharactersPerColumn(20);
|
||||||
|
@ -61,6 +61,7 @@ constexpr int keyboardBufferSize = 16;
|
|||||||
std::vector<std::function<void()>> eventTable;
|
std::vector<std::function<void()>> eventTable;
|
||||||
bool localMemoryWarn = true;
|
bool localMemoryWarn = true;
|
||||||
char *sharedMemory = nullptr;
|
char *sharedMemory = nullptr;
|
||||||
|
std::vector<char> localSharedMemory;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Impl impl;
|
extern Impl impl;
|
||||||
|
Loading…
Reference in New Issue
Block a user