Start major refactoring.

This commit is contained in:
Markus F.X.J. Oberhumer
2006-06-19 19:20:50 +02:00
parent c42fb54bc6
commit bf5cbfffc2
53 changed files with 5150 additions and 1816 deletions
+27 -16
View File
@@ -32,6 +32,7 @@
#include "filter.h"
#include "packer.h"
#include "p_tos.h"
#include "linker.h"
static const
#include "stub/m68k-atari.tos-nrv2b.h"
@@ -75,27 +76,37 @@ const int *PackTos::getFilters() const
}
const upx_byte *PackTos::getLoader() const
Linker* PackTos::newLinker() const
{
if (M_IS_NRV2B(ph.method))
return opt->small ? nrv2b_loader_small : nrv2b_loader;
if (M_IS_NRV2D(ph.method))
return opt->small ? nrv2d_loader_small : nrv2d_loader;
if (M_IS_NRV2E(ph.method))
return opt->small ? nrv2e_loader_small : nrv2e_loader;
return NULL;
return new SimpleBELinker;
}
int PackTos::getLoaderSize() const
int PackTos::buildLoader(const Filter *ft)
{
if (M_IS_NRV2B(ph.method))
return opt->small ? sizeof(nrv2b_loader_small) : sizeof(nrv2b_loader);
if (M_IS_NRV2D(ph.method))
return opt->small ? sizeof(nrv2d_loader_small) : sizeof(nrv2d_loader);
if (M_IS_NRV2E(ph.method))
return opt->small ? sizeof(nrv2e_loader_small) : sizeof(nrv2e_loader);
return 0;
assert(ft->id == 0);
const unsigned char *p = NULL;
size_t l = 0;
if (M_IS_NRV2B(ph.method)) {
p = opt->small ? nrv2b_loader_small : nrv2b_loader;
l = opt->small ? sizeof(nrv2b_loader_small) : sizeof(nrv2b_loader);
}
if (M_IS_NRV2D(ph.method)) {
p = opt->small ? nrv2d_loader_small : nrv2d_loader;
l = opt->small ? sizeof(nrv2d_loader_small) : sizeof(nrv2d_loader);
}
if (M_IS_NRV2E(ph.method)) {
p = opt->small ? nrv2e_loader_small : nrv2e_loader;
l = opt->small ? sizeof(nrv2e_loader_small) : sizeof(nrv2e_loader);
}
delete linker;
linker = newLinker();
linker->init(p, l, -1);
freezeLoader();
return getLoaderSize();
}