Skip to content

Instantly share code, notes, and snippets.

@castaneai
Created January 29, 2020 08:31
Show Gist options
  • Save castaneai/df80108366da3270bcf003daa9f10e14 to your computer and use it in GitHub Desktop.
Save castaneai/df80108366da3270bcf003daa9f10e14 to your computer and use it in GitHub Desktop.
ptes
#include "../headers/EARTH_PT3.h"
#include "../headers/EX_Buffer.h"
#include "Windows.h"
int main(void)
{
auto dll = LoadLibrary(L"SDK_EARTHSOFT_PT3.dll");
auto newBusFunc = reinterpret_cast<EARTH::PT::Bus::NewBusFunction>(GetProcAddress(dll, "_"));
EARTH::PT::Bus* bus;
newBusFunc(&bus);
EARTH::PT::Bus::DeviceInfo deviceInfo;
EARTH::uint32 count = 1;
bus->Scan(&deviceInfo, &count);
EARTH::PT::Device* device;
bus->NewDevice(&deviceInfo, &device);
device->Open();
device->InitTuner();
// start recording
auto buffer = new EARTH::EX::Buffer(device);
const int BLOCK_SIZE = 4096 * 47 * 8;
const int BLOCK_COUNT = 32;
const int BUFFER_SIZE = BLOCK_SIZE * BLOCK_COUNT;
const byte NOT_SYNC_BYTE = 0x74;
buffer->Alloc(BLOCK_SIZE, BLOCK_COUNT);
for (auto i = 0; i < BLOCK_COUNT; i++) {
reinterpret_cast<byte*>(buffer->Ptr(i))[0] = NOT_SYNC_BYTE;
buffer->SyncCpu(i);
}
const auto isdb = EARTH::PT::Device::ISDB::ISDB_T;
const int tunerIndex = 0;
device->SetTransferTestMode(isdb, tunerIndex);
auto pageAddress = buffer->PageDescriptorAddress();
device->SetTransferPageDescriptorAddress(isdb, tunerIndex, pageAddress);
device->SetTransferEnabled(isdb, tunerIndex, true);
while (true) {
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment