mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-03 10:33:52 +00:00
Delete some pointless files
This commit is contained in:
parent
ef9498b03a
commit
0115b18e67
@ -1,140 +0,0 @@
|
||||
#include "../common/debug.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include "../common/unix.h"
|
||||
#endif
|
||||
|
||||
#include <memory.h>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
#include "Opcodes.h"
|
||||
#include "../common/timer.h"
|
||||
#include "MMF.h"
|
||||
|
||||
MMF OpcodesMMF;
|
||||
const MMFOpcodes_Struct* MMFOpcodesData = 0;
|
||||
MMFOpcodes_Struct* MMFOpcodesData_Writable = 0;
|
||||
const uint16 *MMFOpcodesData_emu_to_eq = NULL;
|
||||
uint16 *MMFOpcodesData_emu_to_eq_write = NULL;
|
||||
|
||||
//we choose to store all opcodes as 16 bits, so if they are a different
|
||||
//size in emu, they are gunna get casted to 16 bits... prolly will never
|
||||
//be a problem, but I figured it was noteworthy
|
||||
|
||||
|
||||
DLLFUNC uint16 GetEQOpcode(uint16 emu_op) {
|
||||
if (MMFOpcodesData == 0 || (!OpcodesMMF.IsLoaded()) || emu_op >= MMFOpcodesData->EmuOpcodeCount )
|
||||
return 0;
|
||||
return MMFOpcodesData_emu_to_eq[emu_op];
|
||||
}
|
||||
|
||||
DLLFUNC uint16 GetEmuOpcode(uint16 eq_op) {
|
||||
if (MMFOpcodesData == 0 || (!OpcodesMMF.IsLoaded()) || eq_op >= MMFOpcodesData->EQOpcodeCount )
|
||||
return 0;
|
||||
return MMFOpcodesData->eq_to_emu[eq_op];
|
||||
}
|
||||
|
||||
DLLFUNC bool SetOpcodePair(uint16 emu_op, uint16 eq_op) {
|
||||
if (!MMFOpcodesData_Writable || !MMFOpcodesData_emu_to_eq_write)
|
||||
return false;
|
||||
if (emu_op >= MMFOpcodesData_Writable->EmuOpcodeCount || eq_op >= MMFOpcodesData_Writable->EQOpcodeCount)
|
||||
return false;
|
||||
|
||||
MMFOpcodesData_emu_to_eq_write[emu_op] = eq_op;
|
||||
MMFOpcodesData_Writable->eq_to_emu[eq_op] = emu_op;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
DLLFUNC void ClearEQOpcodes() {
|
||||
if (!MMFOpcodesData_Writable)
|
||||
return;
|
||||
|
||||
memset(MMFOpcodesData_Writable->eq_to_emu, 0, sizeof(uint16)*MMFOpcodesData->EQOpcodeCount);
|
||||
|
||||
}
|
||||
|
||||
DLLFUNC bool DLLLoadOpcodes(CALLBACK_DBLoadOpcodes cb, uint32 opsize, uint32 eq_count, uint32 emu_count, const char *filename) {
|
||||
if(opsize != sizeof(uint16)) {
|
||||
cout << "Error: EMuShareMem: DLLLoadOpcodes: opsize != sizeof(uint16)" << endl;
|
||||
cout << "Opcode size has changed, EMuShareMem.dll needs to be recompiled." << endl;
|
||||
return false;
|
||||
}
|
||||
uint32 tmpMemSize = sizeof(MMFOpcodes_Struct) + opsize * (eq_count+emu_count);
|
||||
if (OpcodesMMF.Open("EQEMuOpcodes", tmpMemSize)) {
|
||||
if (OpcodesMMF.CanWrite()) {
|
||||
MMFOpcodesData_Writable = (MMFOpcodes_Struct*) OpcodesMMF.GetWriteableHandle();
|
||||
if (!MMFOpcodesData_Writable) {
|
||||
cout << "Error: EMuShareMem: DLLLoadOpcodes: !MMFOpcodesData_Writable" << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
//emu_to_eq is right after eq_to_emu
|
||||
MMFOpcodesData_emu_to_eq = MMFOpcodesData_Writable->eq_to_emu + eq_count;
|
||||
MMFOpcodesData_emu_to_eq_write = MMFOpcodesData_Writable->eq_to_emu + eq_count;
|
||||
|
||||
//we need to memset the eq opcodes
|
||||
memset(MMFOpcodesData_Writable->eq_to_emu, 0, sizeof(uint16)*eq_count);
|
||||
|
||||
MMFOpcodesData_Writable->EQOpcodeCount = eq_count;
|
||||
MMFOpcodesData_Writable->EmuOpcodeCount = emu_count;
|
||||
// use a callback so the DB functions are done in the main exe
|
||||
// this way the DLL doesnt have to open a connection to mysql
|
||||
if (!cb(filename)) {
|
||||
cout << "Error: EMuShareMem: DLLLoadOpcodes: !cbDBLoadOpcodes" << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
//we dont disable the write handle here, so we can reload them
|
||||
//MMFOpcodesData_Writable = 0;
|
||||
|
||||
OpcodesMMF.SetLoaded();
|
||||
MMFOpcodesData = (const MMFOpcodes_Struct*) OpcodesMMF.GetHandle();
|
||||
if (!MMFOpcodesData) {
|
||||
cout << "Error: EMuShareMem: DLLLoadOpcodes: !MMFOpcodesData (CanWrite=true)" << endl;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
if (!OpcodesMMF.IsLoaded()) {
|
||||
Timer::SetCurrentTime();
|
||||
uint32 starttime = Timer::GetCurrentTime();
|
||||
while ((!OpcodesMMF.IsLoaded()) && ((Timer::GetCurrentTime() - starttime) < 300000)) {
|
||||
Sleep(10);
|
||||
Timer::SetCurrentTime();
|
||||
}
|
||||
if (!OpcodesMMF.IsLoaded()) {
|
||||
cout << "Error: EMuShareMem: DLLLoadOpcodes: !OpcodesMMF.IsLoaded() (timeout)" << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
MMFOpcodesData = (const MMFOpcodes_Struct*) OpcodesMMF.GetHandle();
|
||||
if (!MMFOpcodesData) {
|
||||
cout << "Error: EMuShareMem: DLLLoadOpcodes: !MMFOpcodesData (CanWrite=false)" << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
//emu_to_eq is right after eq_to_emu
|
||||
MMFOpcodesData_emu_to_eq = MMFOpcodesData->eq_to_emu + MMFOpcodesData->EQOpcodeCount;
|
||||
|
||||
//cheat a little so we can retain writeable handles for reloading
|
||||
MMFOpcodesData_Writable = const_cast<MMFOpcodes_Struct*>(MMFOpcodesData);
|
||||
MMFOpcodesData_emu_to_eq_write = MMFOpcodesData_Writable->eq_to_emu + eq_count;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
cout << "Error Loading Opcodes: Opcodes.cpp: pDLLLoadOpcodes: ret == 0, size = " << tmpMemSize << endl;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
#include "../common/types.h"
|
||||
#include "../common/EMuShareMem.h"
|
||||
|
||||
struct MMFOpcodes_Struct {
|
||||
uint32 EQOpcodeCount;
|
||||
uint32 EmuOpcodeCount;
|
||||
uint16 eq_to_emu[0];
|
||||
//uint16 emu_to_eq[0]; //logical, not really here... EQOpcodeCount indexes in
|
||||
};
|
||||
|
||||
@ -1,142 +0,0 @@
|
||||
#include "../common/debug.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include "../common/unix.h"
|
||||
#endif
|
||||
|
||||
#include <memory.h>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
#include "SkillCaps.h"
|
||||
#include "../common/timer.h"
|
||||
#include "MMF.h"
|
||||
|
||||
MMF SkillCapsMMF;
|
||||
const MMFSkillCaps_Struct* MMFSkillCapsData = 0;
|
||||
MMFSkillCaps_Struct* MMFSkillCapsData_Writable = 0;
|
||||
|
||||
|
||||
DLLFUNC uint16 GetSkillCap(uint8 Class_, uint8 Skill, uint8 Level) {
|
||||
if (MMFSkillCapsData == 0 || (!SkillCapsMMF.IsLoaded()))
|
||||
return 0;
|
||||
if (Class_ >= MMFSkillCapsData->ClassCount || Skill >= MMFSkillCapsData->SkillCount || Level >= MMFSkillCapsData->LevelCount)
|
||||
return(0);
|
||||
|
||||
uint32 index =
|
||||
(((Class_ * MMFSkillCapsData->SkillCount) + Skill) * MMFSkillCapsData->LevelCount)
|
||||
+ Level;
|
||||
|
||||
return MMFSkillCapsData->caps[index];
|
||||
}
|
||||
|
||||
DLLFUNC bool SetSkillCap(uint8 Class_, uint8 Skill, uint8 Level, uint16 cap) {
|
||||
if (!MMFSkillCapsData_Writable)
|
||||
return false;
|
||||
if (Class_ >= MMFSkillCapsData_Writable->ClassCount || Skill >= MMFSkillCapsData_Writable->SkillCount || Level >= MMFSkillCapsData_Writable->LevelCount)
|
||||
return false;
|
||||
|
||||
uint32 index =
|
||||
(((Class_ * MMFSkillCapsData_Writable->SkillCount) + Skill) * MMFSkillCapsData_Writable->LevelCount)
|
||||
+ Level;
|
||||
|
||||
MMFSkillCapsData_Writable->caps[index] = cap;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
DLLFUNC uint8 GetTrainLevel(uint8 Class_, uint8 Skill, uint8 Level){
|
||||
if (MMFSkillCapsData == 0 || (!SkillCapsMMF.IsLoaded()))
|
||||
return 0;
|
||||
if (Class_ >= MMFSkillCapsData->ClassCount || Skill >= MMFSkillCapsData->SkillCount || Level >= MMFSkillCapsData->LevelCount)
|
||||
return(0);
|
||||
|
||||
uint32 index = (((Class_ * MMFSkillCapsData->SkillCount) + Skill) * MMFSkillCapsData->LevelCount);
|
||||
|
||||
for(int x = 0; x < Level; x++){
|
||||
if(MMFSkillCapsData->caps[index + x]){
|
||||
return (x);
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
DLLFUNC void ClearSkillCaps() {
|
||||
if (!MMFSkillCapsData_Writable)
|
||||
return;
|
||||
|
||||
memset(MMFSkillCapsData_Writable->caps, 0,
|
||||
sizeof(uint16)*(MMFSkillCapsData->ClassCount*MMFSkillCapsData->SkillCount*MMFSkillCapsData->LevelCount));
|
||||
|
||||
}
|
||||
|
||||
DLLFUNC bool LoadSkillCaps(CALLBACK_DBLoadSkillCaps cb, uint32 opsize, uint8 ClassCount, uint8 SkillCount, uint8 LevelCount) {
|
||||
if(opsize != sizeof(uint16)) {
|
||||
cout << "Error: EMuShareMem: DLLLoadSkillCaps: opsize != sizeof(uint16)" << endl;
|
||||
cout << "SkillCap size has changed, EMuShareMem.dll needs to be recompiled." << endl;
|
||||
return false;
|
||||
}
|
||||
uint32 tmpMemSize = sizeof(MMFSkillCaps_Struct) + opsize * (ClassCount*SkillCount*LevelCount);
|
||||
if (SkillCapsMMF.Open("EQEMuKSkillCaps", tmpMemSize)) {
|
||||
if (SkillCapsMMF.CanWrite()) {
|
||||
MMFSkillCapsData_Writable = (MMFSkillCaps_Struct*) SkillCapsMMF.GetWriteableHandle();
|
||||
if (!MMFSkillCapsData_Writable) {
|
||||
cout << "Error: EMuShareMem: DLLLoadSkillCaps: !MMFSkillCapsData_Writable" << endl;
|
||||
return false;
|
||||
}
|
||||
//we need to memset the eq SkillCaps
|
||||
memset(MMFSkillCapsData_Writable->caps, 0, sizeof(uint16)*(ClassCount*SkillCount*LevelCount));
|
||||
|
||||
MMFSkillCapsData_Writable->ClassCount = ClassCount;
|
||||
MMFSkillCapsData_Writable->SkillCount = SkillCount;
|
||||
MMFSkillCapsData_Writable->LevelCount = LevelCount;
|
||||
// use a callback so the DB functions are done in the main exe
|
||||
// this way the DLL doesnt have to open a connection to mysql
|
||||
if (!cb()) {
|
||||
cout << "Error: EMuShareMem: DLLLoadSkillCaps: !cbDBLoadSkillCaps" << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
MMFSkillCapsData_Writable = 0;
|
||||
|
||||
SkillCapsMMF.SetLoaded();
|
||||
MMFSkillCapsData = (const MMFSkillCaps_Struct*) SkillCapsMMF.GetHandle();
|
||||
if (!MMFSkillCapsData) {
|
||||
cout << "Error: EMuShareMem: DLLLoadSkillCaps: !MMFSkillCapsData (CanWrite=true)" << endl;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
if (!SkillCapsMMF.IsLoaded()) {
|
||||
Timer::SetCurrentTime();
|
||||
uint32 starttime = Timer::GetCurrentTime();
|
||||
while ((!SkillCapsMMF.IsLoaded()) && ((Timer::GetCurrentTime() - starttime) < 300000)) {
|
||||
Sleep(10);
|
||||
Timer::SetCurrentTime();
|
||||
}
|
||||
if (!SkillCapsMMF.IsLoaded()) {
|
||||
cout << "Error: EMuShareMem: DLLLoadSkillCaps: !SkillCapsMMF.IsLoaded() (timeout)" << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
MMFSkillCapsData = (const MMFSkillCaps_Struct*) SkillCapsMMF.GetHandle();
|
||||
if (!MMFSkillCapsData) {
|
||||
cout << "Error: EMuShareMem: DLLLoadSkillCaps: !MMFSkillCapsData (CanWrite=false)" << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
cout << "Error Loading SkillCaps: SkillCaps.cpp: pDLLLoadSkillCaps: ret == 0, size = " << tmpMemSize << endl;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
#include "../common/types.h"
|
||||
#include "../common/EMuShareMem.h"
|
||||
|
||||
struct MMFSkillCaps_Struct {
|
||||
uint8 ClassCount;
|
||||
uint8 SkillCount;
|
||||
uint8 LevelCount;
|
||||
uint16 caps[0];
|
||||
};
|
||||
|
||||
@ -1,98 +0,0 @@
|
||||
#include "../common/debug.h"
|
||||
#ifdef _WINDOWS
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include "../common/unix.h"
|
||||
#endif
|
||||
|
||||
#include <memory.h>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
#include "Spells.h"
|
||||
#include "../common/timer.h"
|
||||
//#include "../zone/masterentity.h"
|
||||
#include "MMF.h"
|
||||
|
||||
MMF SpellsMMF;
|
||||
const MMFSpells_Struct* MMFSpellsData = 0;
|
||||
MMFSpells_Struct* MMFSpellsData_Writable = 0;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
extern "C" __declspec(dllexport) bool DLLLoadSPDat(const CALLBACK_FileLoadSPDat cbFileLoadSPDat, const void** oSpellsPointer, int32* oSPDAT_RECORDS, uint32 iSPDat_Struct_Size) {
|
||||
return pDLLLoadSPDat(cbFileLoadSPDat, oSpellsPointer, oSPDAT_RECORDS, iSPDat_Struct_Size);
|
||||
};
|
||||
#else
|
||||
extern "C" bool DLLLoadSPDat(const CALLBACK_FileLoadSPDat cbFileLoadSPDat, const void** oSpellsPointer, int32* oSPDAT_RECORDS, uint32 iSPDat_Struct_Size) {
|
||||
return pDLLLoadSPDat(cbFileLoadSPDat, oSpellsPointer, oSPDAT_RECORDS, iSPDat_Struct_Size);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
bool pDLLLoadSPDat(const CALLBACK_FileLoadSPDat cbFileLoadSPDat, const void** oSpellsPointer, int32* oSPDAT_RECORDS, uint32 iSPDat_Struct_Size) {
|
||||
if (iSPDat_Struct_Size != sizeof(SPDat_Spell_Struct)) {
|
||||
cout << "Error: EMuShareMem: DLLLoadSPDat: iSPDat_Struct_Size != sizeof(SPDat_Spell_Struct)" << endl;
|
||||
cout << "SPDat_Spell_Struct has changed, EMuShareMem.dll needs to be recompiled." << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 tmpMemSize = sizeof(MMFSpells_Struct) + 256 + (sizeof(SPDat_Spell_Struct) * (*oSPDAT_RECORDS));
|
||||
if (SpellsMMF.Open("EQEMuSpells", tmpMemSize)) {
|
||||
if (SpellsMMF.CanWrite()) {
|
||||
MMFSpellsData_Writable = (MMFSpells_Struct*) SpellsMMF.GetWriteableHandle();
|
||||
if (!MMFSpellsData_Writable) {
|
||||
cout << "Error: EMuShareMem: DLLLoadSPDat: !MMFSpellsData_Writable" << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
memset(MMFSpellsData_Writable, 0, tmpMemSize);
|
||||
MMFSpellsData_Writable->SPDAT_RECORDS = *oSPDAT_RECORDS;
|
||||
// use a callback so the DB functions are done in the main exe
|
||||
// this way the DLL doesnt have to open a connection to mysql
|
||||
if (MMFSpellsData_Writable->SPDAT_RECORDS > 0) {
|
||||
cbFileLoadSPDat(&MMFSpellsData_Writable->spells[0], MMFSpellsData_Writable->SPDAT_RECORDS-1);
|
||||
*oSpellsPointer = &MMFSpellsData_Writable->spells[0];
|
||||
}
|
||||
else
|
||||
*oSpellsPointer = 0;
|
||||
|
||||
MMFSpellsData_Writable = 0;
|
||||
SpellsMMF.SetLoaded();
|
||||
MMFSpellsData = (const MMFSpells_Struct*) SpellsMMF.GetHandle();
|
||||
if (!MMFSpellsData) {
|
||||
cout << "Error: EMuShareMem: DLLLoadSPDat: !MMFSpellsData (CanWrite=true)" << endl;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
if (!SpellsMMF.IsLoaded()) {
|
||||
Timer::SetCurrentTime();
|
||||
uint32 starttime = Timer::GetCurrentTime();
|
||||
while ((!SpellsMMF.IsLoaded()) && ((Timer::GetCurrentTime() - starttime) < 300000)) {
|
||||
Sleep(100);
|
||||
Timer::SetCurrentTime();
|
||||
}
|
||||
if (!SpellsMMF.IsLoaded()) {
|
||||
cout << "Error: EMuShareMem: DLLLoadSPDat: !SpellsMMF.IsLoaded() (timeout)" << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
MMFSpellsData = (const MMFSpells_Struct*) SpellsMMF.GetHandle();
|
||||
if (!MMFSpellsData) {
|
||||
cout << "Error: EMuShareMem: DLLLoadSPDat: !SpellsMMF (CanWrite=false)" << endl;
|
||||
return false;
|
||||
}
|
||||
*oSPDAT_RECORDS = MMFSpellsData->SPDAT_RECORDS;
|
||||
if (MMFSpellsData->SPDAT_RECORDS > 0)
|
||||
*oSpellsPointer = &MMFSpellsData->spells[0];
|
||||
else
|
||||
*oSpellsPointer = 0;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
cout << "Error Loading SPDat: Spells.cpp: pDLLLoadSPDat: Open() == false" << endl;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
#ifndef MEMSHARE_SPELLS_H
|
||||
#define MEMSHARE_SPELLS_H
|
||||
|
||||
#include "../common/types.h"
|
||||
#include "../common/spdat.h"
|
||||
#include "../common/EMuShareMem.h"
|
||||
|
||||
struct MMFSpells_Struct {
|
||||
uint32 SPDAT_RECORDS; // maxspellid + 1, size of array
|
||||
SPDat_Spell_Struct spells[0];
|
||||
};
|
||||
|
||||
bool pDLLLoadSPDat(const CALLBACK_FileLoadSPDat cbFileLoadSPDat, const void** oSpellsPointer, int32* oSPDAT_RECORDS, uint32 iSPDat_Struct_Size);
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user