Skip to content

Commit

Permalink
Decrease buffer size to support 5.x USB install
Browse files Browse the repository at this point in the history
  • Loading branch information
satelliteseeker committed Oct 17, 2018
1 parent 32cdc0b commit 3f1a8c9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions include/data/buffered_placeholder_writer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace tin::data
{
static const size_t BUFFER_SEGMENT_DATA_SIZE = 0x800000; // Approximately 8MB
static const size_t BUFFER_SEGMENT_DATA_SIZE = 0x100000; // Approximately 1MB

struct BufferSegment
{
Expand All @@ -17,7 +17,7 @@ namespace tin::data
u8 data[BUFFER_SEGMENT_DATA_SIZE] = {0};
};

// Receives data in a circular buffer split into 8MB segments
// Receives data in a circular buffer split into 1MB segments
class BufferedPlaceholderWriter
{
private:
Expand Down
4 changes: 2 additions & 2 deletions source/install/usb_nsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ namespace tin::install::nsp
USBFuncArgs* args = reinterpret_cast<USBFuncArgs*>(in);
tin::util::USBCmdHeader header = tin::util::USBCmdManager::SendFileRangeCmd(args->nspName, args->pfs0Offset, args->ncaSize);

u8* buf = (u8*)memalign(0x1000, 0x800000);
u8* buf = (u8*)memalign(0x1000, 0x100000);
u64 sizeRemaining = header.dataSize;
size_t tmpSizeRead = 0;

try
{
while (sizeRemaining)
{
tmpSizeRead = usbCommsRead(buf, std::min(sizeRemaining, (u64)0x800000));
tmpSizeRead = usbCommsRead(buf, std::min(sizeRemaining, (u64)0x100000));
//LOG_DEBUG("Read bytes\n")
//printBytes(nxlinkout, buf, tmpSizeRead, true);
sizeRemaining -= tmpSizeRead;
Expand Down
2 changes: 1 addition & 1 deletion tools/usb_install_pc.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def file_range_cmd(nsp_dir, in_ep, out_ep, data_size):

curr_off = 0x0
end_off = range_size
read_size = 0x800000
read_size = 0x100000

while curr_off < end_off:
if curr_off + read_size >= end_off:
Expand Down

0 comments on commit 3f1a8c9

Please sign in to comment.