finish removing RandomizeMAC

This commit is contained in:
Arisotura 2022-09-15 21:44:24 +02:00
parent 648bf9fa7f
commit 455c996170
8 changed files with 18 additions and 24 deletions

View File

@ -80,7 +80,6 @@ enum ConfigEntry
Firm_Color, Firm_Color,
Firm_Message, Firm_Message,
Firm_MAC, Firm_MAC,
Firm_RandomizeMAC,
AudioBitrate, AudioBitrate,
}; };

View File

@ -406,6 +406,7 @@ void Reset()
if (rep) if (rep)
{ {
mac[0] &= 0xFC; // ensure the MAC isn't a broadcast MAC
memcpy(&Firmware[0x36], mac, 6); memcpy(&Firmware[0x36], mac, 6);
*(u16*)&Firmware[0x2A] = CRC16(&Firmware[0x2C], *(u16*)&Firmware[0x2C], 0x0000); *(u16*)&Firmware[0x2A] = CRC16(&Firmware[0x2C], *(u16*)&Firmware[0x2C], 0x0000);

View File

@ -106,7 +106,6 @@ int FirmwareBirthdayDay;
int FirmwareFavouriteColour; int FirmwareFavouriteColour;
std::string FirmwareMessage; std::string FirmwareMessage;
std::string FirmwareMAC; std::string FirmwareMAC;
bool RandomizeMAC;
bool SocketBindAnyAddr; bool SocketBindAnyAddr;
std::string LANDevice; std::string LANDevice;
@ -272,7 +271,6 @@ ConfigEntry ConfigFile[] =
{"FirmwareFavouriteColour", 0, &FirmwareFavouriteColour, 0}, {"FirmwareFavouriteColour", 0, &FirmwareFavouriteColour, 0},
{"FirmwareMessage", 2, &FirmwareMessage, (std::string)""}, {"FirmwareMessage", 2, &FirmwareMessage, (std::string)""},
{"FirmwareMAC", 2, &FirmwareMAC, (std::string)""}, {"FirmwareMAC", 2, &FirmwareMAC, (std::string)""},
{"RandomizeMAC", 1, &RandomizeMAC, false},
{"SockBindAnyAddr", 1, &SocketBindAnyAddr, false}, {"SockBindAnyAddr", 1, &SocketBindAnyAddr, false},
{"LANDevice", 2, &LANDevice, (std::string)""}, {"LANDevice", 2, &LANDevice, (std::string)""},

View File

@ -141,7 +141,6 @@ extern int FirmwareBirthdayDay;
extern int FirmwareFavouriteColour; extern int FirmwareFavouriteColour;
extern std::string FirmwareMessage; extern std::string FirmwareMessage;
extern std::string FirmwareMAC; extern std::string FirmwareMAC;
extern bool RandomizeMAC;
extern bool SocketBindAnyAddr; extern bool SocketBindAnyAddr;
extern std::string LANDevice; extern std::string LANDevice;

View File

@ -64,10 +64,8 @@ FirmwareSettingsDialog::FirmwareSettingsDialog(QWidget* parent) : QDialog(parent
ui->overrideFirmwareBox->setChecked(Config::FirmwareOverrideSettings); ui->overrideFirmwareBox->setChecked(Config::FirmwareOverrideSettings);
ui->txtMAC->setText(QString::fromStdString(Config::FirmwareMAC)); ui->txtMAC->setText(QString::fromStdString(Config::FirmwareMAC));
ui->cbRandomizeMAC->setChecked(Config::RandomizeMAC);
on_overrideFirmwareBox_toggled(); on_overrideFirmwareBox_toggled();
on_cbRandomizeMAC_toggled();
} }
FirmwareSettingsDialog::~FirmwareSettingsDialog() FirmwareSettingsDialog::~FirmwareSettingsDialog()
@ -135,7 +133,6 @@ void FirmwareSettingsDialog::done(int r)
std::string newMessage = ui->messageEdit->text().toStdString(); std::string newMessage = ui->messageEdit->text().toStdString();
std::string newMAC = ui->txtMAC->text().toStdString(); std::string newMAC = ui->txtMAC->text().toStdString();
bool newRandomizeMAC = ui->cbRandomizeMAC->isChecked();
if ( newOverride != Config::FirmwareOverrideSettings if ( newOverride != Config::FirmwareOverrideSettings
|| newName != Config::FirmwareUsername || newName != Config::FirmwareUsername
@ -144,8 +141,7 @@ void FirmwareSettingsDialog::done(int r)
|| newBirthdayDay != Config::FirmwareBirthdayDay || newBirthdayDay != Config::FirmwareBirthdayDay
|| newBirthdayMonth != Config::FirmwareBirthdayMonth || newBirthdayMonth != Config::FirmwareBirthdayMonth
|| newMessage != Config::FirmwareMessage || newMessage != Config::FirmwareMessage
|| newMAC != Config::FirmwareMAC || newMAC != Config::FirmwareMAC)
|| newRandomizeMAC != Config::RandomizeMAC)
{ {
if (RunningSomething if (RunningSomething
&& QMessageBox::warning(this, "Reset necessary to apply changes", && QMessageBox::warning(this, "Reset necessary to apply changes",
@ -163,7 +159,6 @@ void FirmwareSettingsDialog::done(int r)
Config::FirmwareMessage = newMessage; Config::FirmwareMessage = newMessage;
Config::FirmwareMAC = newMAC; Config::FirmwareMAC = newMAC;
Config::RandomizeMAC = newRandomizeMAC;
Config::Save(); Config::Save();
@ -210,9 +205,3 @@ void FirmwareSettingsDialog::on_overrideFirmwareBox_toggled()
ui->grpUserSettings->setDisabled(disable); ui->grpUserSettings->setDisabled(disable);
ui->grpWifiSettings->setDisabled(disable); ui->grpWifiSettings->setDisabled(disable);
} }
void FirmwareSettingsDialog::on_cbRandomizeMAC_toggled()
{
bool disable = ui->cbRandomizeMAC->isChecked();
ui->txtMAC->setDisabled(disable);
}

View File

@ -124,7 +124,6 @@ private slots:
void on_cbxBirthdayMonth_currentIndexChanged(int idx); void on_cbxBirthdayMonth_currentIndexChanged(int idx);
void on_overrideFirmwareBox_toggled(); void on_overrideFirmwareBox_toggled();
void on_cbRandomizeMAC_toggled();
private: private:
bool verifyMAC(); bool verifyMAC();

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>511</width> <width>511</width>
<height>342</height> <height>338</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -144,9 +144,9 @@
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QCheckBox" name="cbRandomizeMAC"> <widget class="QLabel" name="label_6">
<property name="text"> <property name="text">
<string>Randomize</string> <string>(leave empty to use default MAC)</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -57,11 +57,11 @@ void IPCInit()
if (!IPCBuffer->attach()) if (!IPCBuffer->attach())
{ {
printf("IPC sharedmem doesn't exist. creating\n"); printf("IPC sharedmem doesn't exist. creating\n");
if (!IPCBuffer->create(4096)) if (!IPCBuffer->create(1024))
{ {
printf("IPC sharedmem create failed :(\n"); printf("IPC sharedmem create failed :(\n");
delete IPCBuffer; delete IPCBuffer;
IPCBuffer= nullptr; IPCBuffer = nullptr;
return; return;
} }
@ -89,7 +89,17 @@ void IPCInit()
void IPCDeInit() void IPCDeInit()
{ {
if (IPCBuffer) delete IPCBuffer; if (IPCBuffer)
{
IPCBuffer->lock();
u8* data = (u8*)IPCBuffer->data();
*(u16*)&data[0] &= ~(1<<IPCInstanceID);
IPCBuffer->unlock();
IPCBuffer->detach();
delete IPCBuffer;
}
IPCBuffer = nullptr; IPCBuffer = nullptr;
} }
@ -195,7 +205,6 @@ bool GetConfigBool(ConfigEntry entry)
case DSiSD_ReadOnly: return Config::DSiSDReadOnly != 0; case DSiSD_ReadOnly: return Config::DSiSDReadOnly != 0;
case DSiSD_FolderSync: return Config::DSiSDFolderSync != 0; case DSiSD_FolderSync: return Config::DSiSDFolderSync != 0;
case Firm_RandomizeMAC: return Config::RandomizeMAC != 0;
case Firm_OverrideSettings: return Config::FirmwareOverrideSettings != 0; case Firm_OverrideSettings: return Config::FirmwareOverrideSettings != 0;
} }