Skip to content

Commit 1958c69

Browse files
author
Alex Dunn
committed
Add fully working test implementation of #1
1 parent 600db53 commit 1958c69

File tree

327 files changed

+54544
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

327 files changed

+54544
-0
lines changed

.gitignore

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
## Ignore Visual Studio temporary files, build results, and
2+
## files generated by popular Visual Studio add-ons.
3+
4+
# User-specific files
5+
*.suo
6+
*.user
7+
*.sln.docstates
8+
9+
# Build results
10+
[Dd]ebug/
11+
[Dd]ebugPublic/
12+
[Rr]elease/
13+
[Rr]eleases/
14+
x64/
15+
x86/
16+
build/
17+
bld/
18+
[Bb]in/
19+
[Oo]bj/
20+
21+
# Roslyn cache directories
22+
*.ide/
23+
24+
# MSTest test Results
25+
[Tt]est[Rr]esult*/
26+
[Bb]uild[Ll]og.*
27+
28+
#NUNIT
29+
*.VisualState.xml
30+
TestResult.xml
31+
32+
# Build Results of an ATL Project
33+
[Dd]ebugPS/
34+
[Rr]eleasePS/
35+
dlldata.c
36+
37+
*_i.c
38+
*_p.c
39+
*_i.h
40+
*.ilk
41+
*.meta
42+
*.obj
43+
*.pch
44+
*.pdb
45+
*.pgc
46+
*.pgd
47+
*.rsp
48+
*.sbr
49+
*.tlb
50+
*.tli
51+
*.tlh
52+
*.tmp
53+
*.tmp_proj
54+
*.log
55+
*.vspscc
56+
*.vssscc
57+
.builds
58+
*.pidb
59+
*.svclog
60+
*.scc
61+
62+
# Chutzpah Test files
63+
_Chutzpah*
64+
65+
# Visual C++ cache files
66+
ipch/
67+
*.aps
68+
*.ncb
69+
*.opensdf
70+
*.sdf
71+
*.cachefile
72+
73+
# Visual Studio profiler
74+
*.psess
75+
*.vsp
76+
*.vspx
77+
78+
# TFS 2012 Local Workspace
79+
$tf/
80+
81+
# Guidance Automation Toolkit
82+
*.gpState
83+
84+
# ReSharper is a .NET coding add-in
85+
_ReSharper*/
86+
*.[Rr]e[Ss]harper
87+
*.DotSettings.user
88+
89+
# JustCode is a .NET coding addin-in
90+
.JustCode
91+
92+
# TeamCity is a build add-in
93+
_TeamCity*
94+
95+
# DotCover is a Code Coverage Tool
96+
*.dotCover
97+
98+
# NCrunch
99+
_NCrunch_*
100+
.*crunch*.local.xml
101+
102+
# MightyMoose
103+
*.mm.*
104+
AutoTest.Net/
105+
106+
# Web workbench (sass)
107+
.sass-cache/
108+
109+
# Installshield output folder
110+
[Ee]xpress/
111+
112+
# DocProject is a documentation generator add-in
113+
DocProject/buildhelp/
114+
DocProject/Help/*.HxT
115+
DocProject/Help/*.HxC
116+
DocProject/Help/*.hhc
117+
DocProject/Help/*.hhk
118+
DocProject/Help/*.hhp
119+
DocProject/Help/Html2
120+
DocProject/Help/html
121+
122+
# Click-Once directory
123+
publish/
124+
125+
# Publish Web Output
126+
*.[Pp]ublish.xml
127+
*.azurePubxml
128+
# TODO: Comment the next line if you want to checkin your web deploy settings
129+
# but database connection strings (with potential passwords) will be unencrypted
130+
*.pubxml
131+
*.publishproj
132+
133+
# NuGet Packages
134+
*.nupkg
135+
# The packages folder can be ignored because of Package Restore
136+
**/packages/*
137+
# except build/, which is used as an MSBuild target.
138+
!**/packages/build/
139+
# If using the old MSBuild-Integrated Package Restore, uncomment this:
140+
#!**/packages/repositories.config
141+
142+
# Windows Azure Build Output
143+
csx/
144+
*.build.csdef
145+
146+
# Windows Store app package directory
147+
AppPackages/
148+
149+
# Others
150+
sql/
151+
*.Cache
152+
ClientBin/
153+
[Ss]tyle[Cc]op.*
154+
~$*
155+
*~
156+
*.dbmdl
157+
*.dbproj.schemaview
158+
*.pfx
159+
*.publishsettings
160+
node_modules/
161+
162+
# RIA/Silverlight projects
163+
Generated_Code/
164+
165+
# Backup & report files from converting an old project file
166+
# to a newer Visual Studio version. Backup files are not needed,
167+
# because we have git ;-)
168+
_UpgradeReport_Files/
169+
Backup*/
170+
UpgradeLog*.XML
171+
UpgradeLog*.htm
172+
173+
# SQL Server files
174+
*.mdf
175+
*.ldf
176+
177+
# Business Intelligence projects
178+
*.rdl.data
179+
*.bim.layout
180+
*.bim_*.settings
181+
182+
# Microsoft Fakes
183+
FakesAssemblies/

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ House Mod for Skyrim
3232
- Append onto `SResoruceArchiveList2`: `Dawnguard.bsa, HearthFires.bsa, Dragonborn.bsa`
3333
1. Set Creation Kit Settings in SkyrimEditor.ini
3434
- `bBlockMessageBoxes=1` (Prevent the annoying error messsgaes on Creation Kit file load)
35+
1. Enable Papyrus Debug Logging. In Skyrim.ini:
36+
- bEnableTrace=1
37+
- bEnableLogging=1
38+
- bLoadDebugInformation=1
3539

3640
##### Everyday Setup
3741
1. Start Creation Kit
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#include "IArchive.h"
2+
#include "IErrors.h"
3+
4+
#if ENABLE_IDYNAMICCREATE
5+
6+
IDynamic * IArchive::iterator::Instantiate(void)
7+
{
8+
IDataSubStream subStream(owner->theStream, GetDataOffset(), GetDataLength());
9+
10+
return IClassRegistry::Instantiate(GetTypeID(), &subStream);
11+
}
12+
13+
void * IArchive::iterator::GetBuffer(UInt32 * outLength)
14+
{
15+
HeaderEntry * entry = GetData();
16+
UInt8 * buf = new UInt8[entry->dataLength];
17+
18+
owner->theStream->SetOffset(entry->dataOffset);
19+
owner->theStream->ReadBuf(buf, entry->dataLength);
20+
21+
if(outLength)
22+
*outLength = entry->dataLength;
23+
24+
return buf;
25+
}
26+
27+
void IArchive::iterator::NextOfType(UInt32 typeID)
28+
{
29+
idx++;
30+
31+
while((GetData()->typeID != typeID) && (idx < owner->header.numEntries))
32+
idx++;
33+
}
34+
35+
void IArchive::iterator::PrevOfType(UInt32 typeID)
36+
{
37+
idx--;
38+
39+
while((GetData()->typeID != typeID) && (idx > 0))
40+
idx--;
41+
}
42+
43+
IArchive::IArchive()
44+
:theStream(NULL), entries(NULL), nameTable(NULL)
45+
{
46+
47+
}
48+
49+
IArchive::IArchive(IDataStream * stream)
50+
:theStream(NULL), entries(NULL), nameTable(NULL)
51+
{
52+
AttachStream(stream);
53+
}
54+
55+
IArchive::~IArchive()
56+
{
57+
Dispose();
58+
}
59+
60+
void IArchive::AttachStream(IDataStream * inStream)
61+
{
62+
Dispose();
63+
64+
theStream = inStream;
65+
}
66+
67+
void IArchive::Dispose(void)
68+
{
69+
if(entries)
70+
{
71+
delete entries;
72+
entries = NULL;
73+
}
74+
75+
if(nameTable)
76+
{
77+
delete nameTable;
78+
nameTable = NULL;
79+
}
80+
}
81+
82+
void IArchive::ReadHeader(void)
83+
{
84+
ASSERT(theStream);
85+
86+
theStream->Rewind();
87+
88+
theStream->ReadBuf(&header, sizeof(FileHeader));
89+
90+
entries = new HeaderEntry[header.numEntries];
91+
theStream->ReadBuf(entries, header.numEntries * sizeof(HeaderEntry));
92+
93+
if(header.nameTableLength)
94+
{
95+
nameTable = new char[header.nameTableLength];
96+
97+
theStream->SetOffset(header.nameTableOffset);
98+
theStream->ReadBuf(nameTable, header.nameTableLength);
99+
}
100+
}
101+
102+
#endif
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#pragma once
2+
3+
#include "common/IDataStream.h"
4+
#include "common/IDynamicCreate.h"
5+
6+
#if ENABLE_IDYNAMICCREATE
7+
8+
/**
9+
* An object archive
10+
*
11+
* This class implements reading and instantiating objects from an object archive.
12+
*/
13+
class IArchive
14+
{
15+
public:
16+
class iterator;
17+
friend iterator;
18+
19+
IArchive();
20+
IArchive(IDataStream * inStream);
21+
~IArchive();
22+
23+
void AttachStream(IDataStream * inStream);
24+
void Dispose(void);
25+
26+
iterator begin(void) { return iterator(0, this); }
27+
iterator end(void) { return iterator(header.numEntries, this); }
28+
29+
static const UInt32 kFileID = CHAR_CODE(0x00, 'A', 'R', 0x01);
30+
static const UInt32 kCurrentVersion = VERSION_CODE(1, 0, 0);
31+
32+
private:
33+
struct FileHeader
34+
{
35+
UInt32 fileID; // IArchive::kFileID
36+
UInt32 version; // IArchive::kCurrentVersion
37+
UInt32 numEntries;
38+
UInt32 nameTableOffset;
39+
UInt32 nameTableLength;
40+
};
41+
42+
struct HeaderEntry
43+
{
44+
UInt32 typeID;
45+
UInt32 subID;
46+
UInt32 dataOffset;
47+
UInt32 dataLength;
48+
UInt32 nameOffset;
49+
};
50+
51+
void ReadHeader(void);
52+
53+
IDataStream * theStream;
54+
55+
FileHeader header;
56+
HeaderEntry * entries;
57+
58+
char * nameTable;
59+
60+
public:
61+
class iterator
62+
{
63+
public:
64+
iterator() { idx = 0; owner = NULL; }
65+
iterator(UInt32 inIdx, IArchive * inArchive) { idx = inIdx; owner = inArchive; }
66+
~iterator() { }
67+
68+
IDynamic * Instantiate(void);
69+
70+
UInt32 GetTypeID(void) { return GetData()->typeID; }
71+
UInt32 GetSubID(void) { return GetData()->subID; }
72+
UInt32 GetDataLength(void) { return GetData()->dataLength; }
73+
char * GetName(void) { return &owner->nameTable[GetData()->nameOffset]; }
74+
void * GetBuffer(UInt32 * outLength);
75+
76+
iterator & operator++() { Next(); return *this; }
77+
iterator & operator--() { Prev(); return *this; }
78+
79+
void NextOfType(UInt32 typeID);
80+
void Next(void) { idx++; }
81+
82+
void PrevOfType(UInt32 typeID);
83+
void Prev(void) { idx--; }
84+
85+
private:
86+
HeaderEntry * GetData(void) { return &owner->entries[idx]; }
87+
88+
UInt32 GetDataOffset(void) { return GetData()->dataOffset; }
89+
90+
UInt32 idx;
91+
IArchive * owner;
92+
};
93+
};
94+
95+
#endif

0 commit comments

Comments
 (0)