More preparations. Also add a README.md
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
// BlitzUtility - Expanding the normal Blitz functionality.
|
||||
// Copyright (C) 2015 Project Kube (Michael Fabian Dirks)
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "DisplayEnumerator.h"
|
||||
|
||||
BOOL CALLBACK BU_DisplayEnumerator_Callback(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) {
|
||||
DisplayEnumerator* displayEnumerator = (DisplayEnumerator*)dwData;
|
||||
|
||||
displayEnumerator->displays.push_back(RECT(*lprcMonitor));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
DLL_METHOD DisplayEnumerator* DLL_CALL BU_DisplayEnumerator_Create() {
|
||||
DisplayEnumerator* displayEnumerator = new DisplayEnumerator();
|
||||
return displayEnumerator;
|
||||
}
|
||||
|
||||
DLL_METHOD void DLL_CALL BU_DisplayEnumerator_Destroy(DisplayEnumerator* displayEnumerator) {
|
||||
delete displayEnumerator;
|
||||
}
|
||||
|
||||
DLL_METHOD uint32_t DLL_CALL BU_DisplayEnumerator_Enumerate(DisplayEnumerator* displayEnumerator) {
|
||||
EnumDisplayMonitors(NULL, NULL, BU_DisplayEnumerator_Callback, (LPARAM)displayEnumerator);
|
||||
|
||||
return displayEnumerator->displays.size();
|
||||
}
|
||||
|
||||
DLL_METHOD uint32_t DLL_CALL BU_DisplayEnumerator_Count(DisplayEnumerator* displayEnumerator) {
|
||||
return displayEnumerator->displays.size();
|
||||
}
|
||||
|
||||
DLL_METHOD void DLL_CALL BU_DisplayEnumerator_Retrieve(DisplayEnumerator* displayEnumerator, uint32_t index, PRECT display) {
|
||||
// Retrieve the requested index.
|
||||
auto iterator = displayEnumerator->displays.begin();
|
||||
std::advance(iterator, index);
|
||||
|
||||
// Copy data.
|
||||
display->left = iterator->left;
|
||||
display->top = iterator->top;
|
||||
display->right = iterator->right;
|
||||
display->bottom = iterator->bottom;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// BlitzUtility - Expanding the normal Blitz functionality.
|
||||
// Copyright (C) 2015 Project Kube (Michael Fabian Dirks)
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#pragma once
|
||||
#include "dllmain.h"
|
||||
#include <list>
|
||||
|
||||
struct DisplayEnumerator {
|
||||
std::list<RECT> displays;
|
||||
};
|
||||
|
||||
// Internal Callback
|
||||
BOOL CALLBACK BU_DisplayEnumerator_Callback(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData);
|
||||
|
||||
// Exported functions.
|
||||
DLL_METHOD DisplayEnumerator* DLL_CALL BU_DisplayEnumerator_Create();
|
||||
#pragma comment(linker, "/EXPORT:BU_DisplayEnumerator_Create=_BU_DisplayEnumerator_Create@0")
|
||||
DLL_METHOD void DLL_CALL BU_DisplayEnumerator_Destroy(DisplayEnumerator* displayEnumerator);
|
||||
#pragma comment(linker, "/EXPORT:BU_DisplayEnumerator_Destroy=_BU_DisplayEnumerator_Destroy@4")
|
||||
DLL_METHOD uint32_t DLL_CALL BU_DisplayEnumerator_Enumerate(DisplayEnumerator* displayEnumerator);
|
||||
#pragma comment(linker, "/EXPORT:BU_DisplayEnumerator_Enumerate=_BU_DisplayEnumerator_Enumerate@4")
|
||||
DLL_METHOD uint32_t DLL_CALL BU_DisplayEnumerator_Count(DisplayEnumerator* displayEnumerator);
|
||||
#pragma comment(linker, "/EXPORT:BU_DisplayEnumerator_Count=_BU_DisplayEnumerator_Count@4")
|
||||
DLL_METHOD void DLL_CALL BU_DisplayEnumerator_Retrieve(DisplayEnumerator* displayEnumerator, uint32_t index, LPRECT display);
|
||||
#pragma comment(linker, "/EXPORT:BU_DisplayEnumerator_Retrieve=_BU_DisplayEnumerator_Retrieve@12")
|
||||
@@ -0,0 +1,200 @@
|
||||
// Blitz - Steam wrapper for Blitz.
|
||||
// Copyright (C) 2015 Project Kube (Michael Fabian Dirks)
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#pragma once
|
||||
#include "dllmain.h"
|
||||
#include "MassOp.h"
|
||||
|
||||
MassOp::MassOp(uint32_t length) : length(length) {
|
||||
this->instructions = new MassOpInstruction[length];
|
||||
}
|
||||
|
||||
MassOp::~MassOp() {
|
||||
delete this->instructions;
|
||||
}
|
||||
|
||||
DLL_METHOD MassOp* DLL_CALL BU_MassOp_Create(uint32_t length) {
|
||||
MassOp* myMassOp = new MassOp(length);
|
||||
return myMassOp;
|
||||
}
|
||||
|
||||
DLL_METHOD void DLL_CALL BU_MassOp_Destroy(MassOp* massop) {
|
||||
delete massop;
|
||||
}
|
||||
|
||||
DLL_METHOD void DLL_CALL BU_MassOp_Instruction(MassOp* massop, uint32_t index, MassOpType type, MassOpCode code, intptr_t leftOperand, intptr_t rightOperand, intptr_t result) {
|
||||
massop->instructions[index].type = type;
|
||||
massop->instructions[index].code = code;
|
||||
massop->instructions[index].leftOperand = leftOperand;
|
||||
massop->instructions[index].rightOperand = rightOperand;
|
||||
massop->instructions[index].result = result;
|
||||
}
|
||||
|
||||
DLL_METHOD void DLL_CALL BU_MassOp_Run(MassOp* massop) {
|
||||
for (uint32_t index = 0; index < massop->length; index++) {
|
||||
MassOpInstruction* instr = &massop->instructions[index];
|
||||
switch (instr->code) {
|
||||
case GoTo:
|
||||
index = instr->leftOperand;
|
||||
break;
|
||||
case SetOpCode:
|
||||
massop->instructions[instr->leftOperand].code = instr->rightOperand;
|
||||
break;
|
||||
case CopyLeft:
|
||||
if (instr->leftOperand != instr->rightOperand) {
|
||||
switch (instr->result) {
|
||||
case 0:
|
||||
massop->instructions[instr->rightOperand].leftOperand = massop->instructions[instr->leftOperand].leftOperand;
|
||||
break;
|
||||
case 1:
|
||||
massop->instructions[instr->rightOperand].rightOperand = massop->instructions[instr->leftOperand].leftOperand;
|
||||
break;
|
||||
case 2:
|
||||
massop->instructions[instr->rightOperand].result = massop->instructions[instr->leftOperand].leftOperand;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CopyRight:
|
||||
if (instr->leftOperand != instr->rightOperand) {
|
||||
switch (instr->result) {
|
||||
case 0:
|
||||
massop->instructions[instr->rightOperand].leftOperand = massop->instructions[instr->leftOperand].rightOperand;
|
||||
break;
|
||||
case 1:
|
||||
massop->instructions[instr->rightOperand].rightOperand = massop->instructions[instr->leftOperand].rightOperand;
|
||||
break;
|
||||
case 2:
|
||||
massop->instructions[instr->rightOperand].result = massop->instructions[instr->leftOperand].rightOperand;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CopyOut:
|
||||
if (instr->leftOperand != instr->rightOperand) {
|
||||
switch (instr->result) {
|
||||
case 0:
|
||||
massop->instructions[instr->rightOperand].leftOperand = massop->instructions[instr->leftOperand].result;
|
||||
break;
|
||||
case 1:
|
||||
massop->instructions[instr->rightOperand].rightOperand = massop->instructions[instr->leftOperand].result;
|
||||
break;
|
||||
case 2:
|
||||
massop->instructions[instr->rightOperand].result = massop->instructions[instr->leftOperand].result;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case If:
|
||||
if (instr->leftOperand != instr->rightOperand) {
|
||||
if (massop->instructions[instr->leftOperand].result == massop->instructions[instr->rightOperand].result) {
|
||||
index += instr->result;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IfValue:
|
||||
if (instr->leftOperand != instr->rightOperand) {
|
||||
if (massop->instructions[instr->rightOperand].result == instr->rightOperand) {
|
||||
index += instr->result;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
switch (instr->type) {
|
||||
case Double:
|
||||
switch (instr->code) {
|
||||
case Create:
|
||||
instr->result = (uint32_t)BU_Double_Create();
|
||||
break;
|
||||
case Destroy:
|
||||
BU_Double_Destroy((double_t*)instr->leftOperand);
|
||||
break;
|
||||
case Copy:
|
||||
instr->result = (uint32_t)BU_Double_Copy((double_t*)instr->leftOperand);
|
||||
break;
|
||||
case TempCreate:
|
||||
instr->result = (uint32_t)BU_Double_TempCreate();
|
||||
break;
|
||||
case TempCopy:
|
||||
instr->result = (uint32_t)BU_Double_TempCopy((double_t*)instr->leftOperand);
|
||||
break;
|
||||
case TempCleanup:
|
||||
BU_Double_TempCleanup();
|
||||
break;
|
||||
case Set:
|
||||
BU_Double_Set((double_t*)instr->leftOperand, (double_t*)instr->rightOperand);
|
||||
break;
|
||||
case Add:
|
||||
BU_Double_Add((double_t*)instr->leftOperand, (double_t*)instr->rightOperand);
|
||||
break;
|
||||
case Sub:
|
||||
BU_Double_Sub((double_t*)instr->leftOperand, (double_t*)instr->rightOperand);
|
||||
break;
|
||||
case Mul:
|
||||
BU_Double_Mul((double_t*)instr->leftOperand, (double_t*)instr->rightOperand);
|
||||
break;
|
||||
case Div:
|
||||
BU_Double_Div((double_t*)instr->leftOperand, (double_t*)instr->rightOperand);
|
||||
break;
|
||||
case Compare:
|
||||
instr->result = BU_Double_Compare((double_t*)instr->leftOperand, (double_t*)instr->rightOperand);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case LongLong:
|
||||
switch (instr->code) {
|
||||
case Create:
|
||||
instr->result = (uint32_t)BU_LongLong_Create();
|
||||
break;
|
||||
case Destroy:
|
||||
BU_LongLong_Destroy((int64_t*)instr->leftOperand);
|
||||
break;
|
||||
case Copy:
|
||||
instr->result = (uint32_t)BU_LongLong_Copy((int64_t*)instr->leftOperand);
|
||||
break;
|
||||
case TempCreate:
|
||||
instr->result = (uint32_t)BU_LongLong_TempCreate();
|
||||
break;
|
||||
case TempCopy:
|
||||
instr->result = (uint32_t)BU_LongLong_TempCopy((int64_t*)instr->leftOperand);
|
||||
break;
|
||||
case TempCleanup:
|
||||
BU_LongLong_TempCleanup();
|
||||
break;
|
||||
case Set:
|
||||
BU_LongLong_Set((int64_t*)instr->leftOperand, (int64_t*)instr->rightOperand);
|
||||
break;
|
||||
case Add:
|
||||
BU_LongLong_Add((int64_t*)instr->leftOperand, (int64_t*)instr->rightOperand);
|
||||
break;
|
||||
case Sub:
|
||||
BU_LongLong_Sub((int64_t*)instr->leftOperand, (int64_t*)instr->rightOperand);
|
||||
break;
|
||||
case Mul:
|
||||
BU_LongLong_Mul((int64_t*)instr->leftOperand, (int64_t*)instr->rightOperand);
|
||||
break;
|
||||
case Div:
|
||||
BU_LongLong_Div((int64_t*)instr->leftOperand, (int64_t*)instr->rightOperand);
|
||||
break;
|
||||
case Compare:
|
||||
instr->result = BU_LongLong_Compare((int64_t*)instr->leftOperand, (int64_t*)instr->rightOperand);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
// Blitz - Steam wrapper for Blitz.
|
||||
// Copyright (C) 2015 Project Kube (Michael Fabian Dirks)
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#pragma once
|
||||
#include "dllmain.h"
|
||||
#include "Type\Double.h"
|
||||
#include "Type\LongLong.h"
|
||||
|
||||
enum MassOpType {
|
||||
LongLong = 0,
|
||||
Double = 1,
|
||||
|
||||
Vector2 = 10,
|
||||
Vector3 = 11,
|
||||
};
|
||||
|
||||
enum MassOpCode {
|
||||
Create = 0,
|
||||
Destroy = 1,
|
||||
Copy = 2,
|
||||
TempCreate = 5,
|
||||
TempCopy = 6,
|
||||
TempCleanup = 7,
|
||||
|
||||
Set = 10,
|
||||
Add = 11,
|
||||
Sub = 12,
|
||||
Mul = 13,
|
||||
Div = 14,
|
||||
Compare = 15,
|
||||
|
||||
// Special OPCodes (Control MassOp)
|
||||
// Goto - Go to a specific intruction
|
||||
// oper_l = target massop index
|
||||
GoTo = 249,
|
||||
// SetOpCode - Change OpCode at position
|
||||
// oper_l = target massop index
|
||||
// oper_r = new OpCode
|
||||
SetOpCode = 250,
|
||||
// CopyLeft - Copy oper_l to new MassOp instruction.
|
||||
// oper_l = source massop index
|
||||
// oper_r = target massop index
|
||||
// out = target position (0/oper_l, 1/oper_r, 2/out)
|
||||
CopyLeft = 251,
|
||||
// CopyRight - Copy oper_r to new MassOp instruction.
|
||||
// oper_l = source massop index
|
||||
// oper_r = target massop index
|
||||
// out = target position (0/oper_l, 1/oper_r, 2/out)
|
||||
CopyRight = 252,
|
||||
// CopyOut - Copy out to new MassOp instruction.
|
||||
// oper_l = source massop index
|
||||
// oper_r = target massop index
|
||||
// out = target position (0/oper_l, 1/oper_r, 2/out)
|
||||
CopyOut = 253,
|
||||
// If - If the result of index oper_l is equal to index oper_r, skip out instructions.
|
||||
// oper_l = source massop index
|
||||
// oper_r = target massop index
|
||||
// out = instructions to skip
|
||||
If = 254,
|
||||
// IfValue - If the result of index oper_l is equal to oper_r, skip out instructions.
|
||||
// oper_l = source massop index
|
||||
// oper_r = value to compare with
|
||||
// out = instructions to skip
|
||||
IfValue = 255
|
||||
};
|
||||
|
||||
struct BlitzBank {
|
||||
uint32_t identifier;
|
||||
uint32_t address;
|
||||
uint32_t size;
|
||||
};
|
||||
|
||||
struct MassOpInstruction {
|
||||
uint8_t type;
|
||||
uint8_t code;
|
||||
uint32_t leftOperand, rightOperand;
|
||||
uint32_t result;
|
||||
};
|
||||
|
||||
struct MassOp {
|
||||
MassOp(uint32_t length);
|
||||
~MassOp();
|
||||
|
||||
uint32_t length;
|
||||
MassOpInstruction* instructions;
|
||||
};
|
||||
|
||||
DLL_METHOD MassOp* DLL_CALL BU_MassOp_Create(uint32_t length);
|
||||
#pragma comment(linker, "/EXPORT:BU_MassOp_Create=_BU_MassOp_Create@4")
|
||||
DLL_METHOD void DLL_CALL BU_MassOp_Destroy(MassOp* massop);
|
||||
#pragma comment(linker, "/EXPORT:BU_MassOp_Destroy=_BU_MassOp_Destroy@4")
|
||||
DLL_METHOD void DLL_CALL BU_MassOp_Instruction(MassOp* massop, uint32_t index, MassOpType type, MassOpCode code, intptr_t leftOperand, intptr_t rightOperand, intptr_t result);
|
||||
#pragma comment(linker, "/EXPORT:BU_MassOp_Instruction=_BU_MassOp_Instruction@28")
|
||||
DLL_METHOD void DLL_CALL BU_MassOp_Run(MassOp* massop);
|
||||
#pragma comment(linker, "/EXPORT:BU_MassOp_Run=_BU_MassOp_Run@4")
|
||||
Reference in New Issue
Block a user