mirror of
https://github.com/rwengine/openrw.git
synced 2024-09-04 09:39:46 +02:00
Cleanup SCMFile
This commit is contained in:
parent
81c1bb947d
commit
d9aded5415
@ -11,14 +11,14 @@ void SCMFile::loadFile(char *data, unsigned int size)
|
||||
|
||||
_target = static_cast<SCMTarget>(_data[jumpOpSize]);
|
||||
globalSectionOffset = jumpOpSize+1u;
|
||||
modelSectionOffset = read<uint32>(jumpParamSize) + jumpOpSize + 1u;
|
||||
missionSectionOffset = read<uint32>(modelSectionOffset-jumpOpSize-1u+jumpParamSize) + jumpOpSize + 1u;
|
||||
codeSectionOffset = read<uint32>(missionSectionOffset-jumpOpSize-1u+jumpParamSize);
|
||||
modelSectionOffset = read<uint32_t>(jumpParamSize) + jumpOpSize + 1u;
|
||||
missionSectionOffset = read<uint32_t>(modelSectionOffset-jumpOpSize-1u+jumpParamSize) + jumpOpSize + 1u;
|
||||
codeSectionOffset = read<uint32_t>(missionSectionOffset-jumpOpSize-1u+jumpParamSize);
|
||||
|
||||
unsigned int model_count = read<uint32>(modelSectionOffset);
|
||||
unsigned int model_count = read<uint32_t>(modelSectionOffset);
|
||||
models.reserve(model_count);
|
||||
|
||||
int i = modelSectionOffset + sizeof(uint32);
|
||||
int i = modelSectionOffset + sizeof(uint32_t);
|
||||
for(unsigned int m = 0; m < model_count; ++m) {
|
||||
char model_name[24];
|
||||
for(size_t c = 0; c < 24; ++c) {
|
||||
@ -28,16 +28,16 @@ void SCMFile::loadFile(char *data, unsigned int size)
|
||||
}
|
||||
|
||||
i = missionSectionOffset;
|
||||
mainSize = read<uint32>(i);
|
||||
i += sizeof(uint32);
|
||||
missionLargestSize = read<uint32>(i);
|
||||
i += sizeof(uint32);
|
||||
unsigned int missionCount = read<uint32>(i);
|
||||
mainSize = read<uint32_t>(i);
|
||||
i += sizeof(uint32_t);
|
||||
missionLargestSize = read<uint32_t>(i);
|
||||
i += sizeof(uint32_t);
|
||||
unsigned int missionCount = read<uint32_t>(i);
|
||||
missionOffsets.reserve(missionCount);
|
||||
i += sizeof(uint32);
|
||||
i += sizeof(uint32_t);
|
||||
|
||||
for(unsigned int m = 0; m < missionCount; ++m) {
|
||||
missionOffsets.push_back(read<uint32>(i));
|
||||
i += sizeof(uint32);
|
||||
missionOffsets.push_back(read<uint32_t>(i));
|
||||
i += sizeof(uint32_t);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
#ifndef _SCMFILE_HPP_
|
||||
#define _SCMFILE_HPP_
|
||||
#ifndef RWENGINE_SCMFILE_HPP
|
||||
#define RWENGINE_SCMFILE_HPP
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <script/ScriptTypes.hpp>
|
||||
@ -11,10 +10,6 @@
|
||||
class SCMFile {
|
||||
public:
|
||||
|
||||
typedef std::uint32_t uint32;
|
||||
typedef std::uint16_t u16;
|
||||
typedef std::uint8_t u8;
|
||||
|
||||
enum SCMTarget {
|
||||
NoTarget = 0,
|
||||
GTAIII = 0xC6,
|
||||
@ -41,17 +36,17 @@ public:
|
||||
return *(T*)(_data+offset);
|
||||
}
|
||||
|
||||
uint32 getMainSize() const { return mainSize; }
|
||||
uint32 getLargestMissionSize() const { return missionLargestSize; }
|
||||
uint32_t getMainSize() const { return mainSize; }
|
||||
uint32_t getLargestMissionSize() const { return missionLargestSize; }
|
||||
|
||||
const std::vector<std::string>& getModels() const { return models; }
|
||||
|
||||
const std::vector<unsigned int>& getMissionOffsets() const { return missionOffsets; }
|
||||
|
||||
std::uint32_t getGlobalSection() const { return globalSectionOffset; }
|
||||
std::uint32_t getModelSection() const { return modelSectionOffset; }
|
||||
std::uint32_t getMissionSection() const { return missionSectionOffset; }
|
||||
std::uint32_t getCodeSection() const { return codeSectionOffset; }
|
||||
uint32_t getGlobalSection() const { return globalSectionOffset; }
|
||||
uint32_t getModelSection() const { return modelSectionOffset; }
|
||||
uint32_t getMissionSection() const { return missionSectionOffset; }
|
||||
uint32_t getCodeSection() const { return codeSectionOffset; }
|
||||
|
||||
unsigned int getGlobalsSize() const { return modelSectionOffset - globalSectionOffset; }
|
||||
|
||||
@ -65,13 +60,13 @@ private:
|
||||
|
||||
std::vector<unsigned int> missionOffsets;
|
||||
|
||||
uint32 mainSize;
|
||||
uint32 missionLargestSize;
|
||||
uint32_t mainSize;
|
||||
uint32_t missionLargestSize;
|
||||
|
||||
uint32 globalSectionOffset;
|
||||
uint32 modelSectionOffset;
|
||||
uint32 missionSectionOffset;
|
||||
uint32 codeSectionOffset;
|
||||
uint32_t globalSectionOffset;
|
||||
uint32_t modelSectionOffset;
|
||||
uint32_t missionSectionOffset;
|
||||
uint32_t codeSectionOffset;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user